Skip to content

Commit

Permalink
#517 Fix bookmarks export on windows
Browse files Browse the repository at this point in the history
uazo committed Nov 15, 2023
1 parent 9d0b97f commit 15fe961
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions build/patches/Add-bookmark-import-export-actions.patch
Original file line number Diff line number Diff line change
@@ -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 | 13 +-
.../browser/bookmarks/bookmark_html_writer.cc | 11 +
.../dialogs/DownloadLocationCustomView.java | 8 +-
.../DownloadLocationDialogCoordinator.java | 8 +-
chrome/browser/flag_descriptions.cc | 5 +
@@ -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, 923 insertions(+), 30 deletions(-)
44 files changed, 922 insertions(+), 29 deletions(-)

diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
--- a/chrome/android/java/AndroidManifest.xml
@@ -864,7 +864,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -9847,6 +9847,14 @@ const FeatureEntry kFeatureEntries[] = {
@@ -9826,6 +9826,14 @@ const FeatureEntry kFeatureEntries[] = {
FEATURE_VALUE_TYPE(features::kForceOffTextAutosizing)},
#endif

@@ -1296,12 +1296,10 @@ 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"
@@ -228,8 +231,16 @@ class Writer : public base::RefCountedThreadSafe<Writer> {

@@ -229,7 +232,15 @@ 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 | base::File::FLAG_OPEN_TRUNCATED;
int flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE;
+#if BUILDFLAG(IS_ANDROID)
+ if (path_.IsContentUri()) {
+ file_ = std::make_unique<base::File>(base::OpenContentUriForWrite(path_));
@@ -1384,7 +1382,7 @@ diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browse
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -7763,6 +7763,11 @@ const char kEnableBoundSessionCredentialsDescription[] =
@@ -7757,6 +7757,11 @@ const char kEnableBoundSessionCredentialsDescription[] =
"prevent the usage of bound credentials outside of the user device.";
#endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)

@@ -1399,7 +1397,7 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descripti
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -4496,6 +4496,9 @@ extern const char kEnableBoundSessionCredentialsName[];
@@ -4493,6 +4493,9 @@ extern const char kEnableBoundSessionCredentialsName[];
extern const char kEnableBoundSessionCredentialsDescription[];
#endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)

2 changes: 1 addition & 1 deletion build/patches/Add-support-for-writing-URIs.patch
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ diff --git a/base/android/java/src/org/chromium/base/ContentUriUtils.java b/base
+ ContentResolver resolver = ContextUtils.getApplicationContext().getContentResolver();
+ ContentProviderClient client = resolver.acquireContentProviderClient(
+ uri.getAuthority());
+ ParcelFileDescriptor pfd = client.openFile(uri, "rw");
+ ParcelFileDescriptor pfd = client.openFile(uri, "wt");
+ int fd = pfd.detachFd();
+ client.close();
+ return fd;

0 comments on commit 15fe961

Please sign in to comment.