#477 Add FLAG_OPEN_TRUNCATED while exporting
This commit is contained in:
@@ -29,7 +29,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
chrome/browser/about_flags.cc | 8 +
|
||||
.../bookmarks/android/bookmark_bridge.cc | 283 ++++++++++++++++++
|
||||
.../bookmarks/android/bookmark_bridge.h | 30 +-
|
||||
.../browser/bookmarks/bookmark_html_writer.cc | 11 +
|
||||
.../browser/bookmarks/bookmark_html_writer.cc | 13 +-
|
||||
.../dialogs/DownloadLocationCustomView.java | 8 +-
|
||||
.../DownloadLocationDialogCoordinator.java | 8 +-
|
||||
chrome/browser/flag_descriptions.cc | 5 +
|
||||
@@ -43,7 +43,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
.../strings/android_chrome_strings.grd | 18 ++
|
||||
chrome/common/BUILD.gn | 3 +
|
||||
chrome/utility/BUILD.gn | 7 +-
|
||||
.../utility/importer/bookmark_html_reader.cc | 27 +-
|
||||
.../utility/importer/bookmark_html_reader.cc | 28 +-
|
||||
.../utility/importer/bookmark_html_reader.h | 8 +
|
||||
.../headless_select_file_dialog.cc | 4 +
|
||||
.../chromium/ui/base/SelectFileDialog.java | 18 +-
|
||||
@@ -54,7 +54,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
||||
ui/shell_dialogs/select_file_dialog_linux.cc | 4 +
|
||||
ui/shell_dialogs/select_file_dialog_linux.h | 2 +
|
||||
ui/shell_dialogs/select_file_dialog_win.cc | 5 +
|
||||
44 files changed, 921 insertions(+), 29 deletions(-)
|
||||
44 files changed, 923 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
|
||||
--- a/chrome/android/java/AndroidManifest.xml
|
||||
@@ -1296,10 +1296,12 @@ diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/b
|
||||
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
|
||||
#include "chrome/browser/favicon/favicon_service_factory.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@@ -229,7 +232,15 @@ class Writer : public base::RefCountedThreadSafe<Writer> {
|
||||
@@ -228,8 +231,16 @@ class Writer : public base::RefCountedThreadSafe<Writer> {
|
||||
|
||||
// Opens the file, returning true on success.
|
||||
bool OpenFile() {
|
||||
int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE;
|
||||
- int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE;
|
||||
+ int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE | base::File::FLAG_OPEN_TRUNCATED;
|
||||
+#if BUILDFLAG(IS_ANDROID)
|
||||
+ if (path_.IsContentUri()) {
|
||||
+ file_ = std::make_unique<base::File>(base::OpenContentUriForWrite(path_));
|
||||
@@ -1623,7 +1625,7 @@ diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/im
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -105,14 +109,28 @@ static std::string stripDt(const std::string& lineDt) {
|
||||
@@ -105,14 +109,29 @@ static std::string stripDt(const std::string& lineDt) {
|
||||
}
|
||||
|
||||
void ImportBookmarksFile(
|
||||
@@ -1642,7 +1644,8 @@ diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/im
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ImportBookmarksFile(cancellation_callback, valid_url_callback, content, bookmarks, search_engines, favicons);
|
||||
+ ImportBookmarksFile(cancellation_callback, valid_url_callback,
|
||||
+ content, bookmarks, search_engines, favicons);
|
||||
+}
|
||||
+
|
||||
+void ImportBookmarksFile(
|
||||
@@ -1655,7 +1658,7 @@ diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/im
|
||||
std::vector<std::string> lines = base::SplitString(
|
||||
content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
|
||||
|
||||
@@ -125,6 +143,7 @@ void ImportBookmarksFile(
|
||||
@@ -125,6 +144,7 @@ void ImportBookmarksFile(
|
||||
std::vector<std::u16string> path;
|
||||
size_t toolbar_folder_index = 0;
|
||||
std::string charset = "UTF-8"; // If no charset is specified, assume utf-8.
|
||||
@@ -1663,7 +1666,7 @@ diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/im
|
||||
for (size_t i = 0;
|
||||
i < lines.size() &&
|
||||
(cancellation_callback.is_null() || !cancellation_callback.Run());
|
||||
@@ -217,10 +236,12 @@ void ImportBookmarksFile(
|
||||
@@ -217,10 +237,12 @@ void ImportBookmarksFile(
|
||||
}
|
||||
bookmarks->push_back(entry);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user