Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import export bookmarks android #17821

Merged
merged 1 commit into from
May 13, 2023
Merged

Conversation

tapanmodh
Copy link
Contributor

@tapanmodh tapanmodh commented Mar 29, 2023

Resolves brave/brave-browser#6378

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Import Bookmarks:
Users can import an HTML file containing bookmarks via the bookmarks screen.

Export Bookmarks
Users should be able to export an HTML file containing bookmarks from the bookmarks screen.

device-2023-04-11-174934.mp4

@tapanmodh tapanmodh added CI/skip-macos-x64 Do not run CI builds for macOS x64 CI/skip-ios Do not run CI builds for iOS CI/skip-windows-x86 CI/skip-windows-x64 Do not run CI builds for Windows x64 unused-CI/skip-linux-x64 Do not run CI builds for Linux x64 labels Mar 29, 2023
@tapanmodh tapanmodh force-pushed the import_export_bookmarks_android branch 2 times, most recently from cd64552 to f2a05e0 Compare April 5, 2023 11:41
@tapanmodh tapanmodh changed the title wip - import export bookmarks android import export bookmarks android Apr 5, 2023
@tapanmodh tapanmodh force-pushed the import_export_bookmarks_android branch 2 times, most recently from b1cc736 to 979befd Compare April 6, 2023 19:44
@tapanmodh tapanmodh added this to the 1.52.x - Nightly milestone Apr 6, 2023
@tapanmodh tapanmodh marked this pull request as ready for review April 6, 2023 19:54
@tapanmodh tapanmodh requested review from a team as code owners April 6, 2023 19:54
@tapanmodh tapanmodh force-pushed the import_export_bookmarks_android branch 2 times, most recently from 983e5f2 to b1fddef Compare May 2, 2023 20:43
Copy link
Contributor

@AlexeyBarabash AlexeyBarabash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Copy link
Contributor

@samartnik samartnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

base::FilePath file_export_path =
base::FilePath::FromUTF16Unsafe(export_path);

BookmarksExportObserver* observer = new FileBookmarksExportObserver(obj);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's deleting this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't need to use the observer, then it seems like we can just pass in a nullptr like upstream does here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to use this observer to get the result for exporting the bookmarks to display success or failure dialog to the user.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, it deletes itself in OnExportFinished. Got it. Thanks.

common/sources.gni Outdated Show resolved Hide resolved
@tapanmodh tapanmodh requested a review from mkarolin May 10, 2023 14:04
Comment on lines +6 to +13
if (is_android) {
brave_common_sources = [
"//chrome/common/importer/imported_bookmark_entry.cc",
"//chrome/common/importer/imported_bookmark_entry.h",
]
}
Copy link
Collaborator

@mkarolin mkarolin May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion to minimize patching:

brave_common_sources = []

if (is_android) {
  brave_common_sources += [
    "//chrome/common/importer/imported_bookmark_entry.cc",
    "//chrome/common/importer/imported_bookmark_entry.h",
  ]
}

and then there would be no need to have the if (is_android) in patches/chrome-common-BUILD.gn.patch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll update it

Copy link
Collaborator

@mkarolin mkarolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tapanmodh tapanmodh force-pushed the import_export_bookmarks_android branch from 0dd1ffe to d4cfc48 Compare May 10, 2023 20:27
Copy link
Contributor

@deeppandya deeppandya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : we should have newline for all new classes.

@@ -48,6 +48,7 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/app/BraveActivity.java",
"../../brave/android/java/org/chromium/chrome/browser/app/appmenu/AppMenuIconRowFooter.java",
"../../brave/android/java/org/chromium/chrome/browser/app/appmenu/BraveAppMenuPropertiesDelegateImpl.java",
"../../brave/android/java/org/chromium/chrome/browser/app/bookmarks/BraveBookmarkActivity.java",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tapanmodh can we move BraveBookmarkActivity to bookmark directory ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BraveBookmarkActivity is in same place as BookmarkActivity from chromium. I think we shouldn't move to bookmark directory.

android:theme="@style/Theme.Chromium.Activity.Fullscreen"
android:exported="false"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, Why do we need MCC and MNC here ? i think it's useful when we need to have configChanges for mobile country code change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just use the same as BookmarkActivity has in chromium AndroidManifest

if (mWindowAndroid.handlePermissionResult(requestCode, permissions, grantResults)) return;
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think newline is there in the code

deleteField(sBraveBookmarkActivityClassName, "mBookmarkManagerCoordinator");
makeProtectedField(sBookmarkActivityClassName, "mBookmarkManagerCoordinator");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think newline is there in the code

deleteField(sBraveBookmarkBridgeClassName, "mNativeBookmarkBridge");
makeProtectedField(sBookmarkBridgeClassName, "mNativeBookmarkBridge");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think newline is there in the code

deleteField(sBraveBookmarkManagerMediatorClassName, "mContext");
makeProtectedField(sBookmarkManagerMediatorClassName, "mContext");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

deleteMethod(sBraveBookmarkModelClassName, "importBookmarks");
deleteMethod(sBraveBookmarkModelClassName, "exportBookmarks");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

deleteField(sBraveBookmarkPageClassName, "mManager");
makeProtectedField(sBookmarkPageClassName, "mManager");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

deleteField(sBraveBookmarkToolbarClassName, "mBookmarkModel");
makeProtectedField(sBookmarkToolbarClassName, "mBookmarkModel");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

deleteField(sBraveBookmarkToolbarCoordinatorClassName, "mToolbar");
makeProtectedField(sBookmarkToolbarCoordinatorClassName, "mToolbar");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit : newline at the end

Copy link
Contributor

@deeppandya deeppandya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tapanmodh tapanmodh merged commit 87c07a9 into master May 13, 2023
@tapanmodh tapanmodh deleted the import_export_bookmarks_android branch May 13, 2023 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/skip-ios Do not run CI builds for iOS CI/skip-macos-x64 Do not run CI builds for macOS x64
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bookmark import/export on Android
9 participants