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

Show dialog when Brave tries to import Safari data w/o disk permission #4530

Merged
merged 1 commit into from
Feb 20, 2020

Conversation

simonhong
Copy link
Member

@simonhong simonhong commented Feb 6, 2020

Show tab modal dialog when Brave tries to import Safari data w/o disk permission

fix brave/brave-browser#2710

image

Submitter Checklist:

Test Plan:

  1. Check Brave doesn't have full disk access permission
  2. Launch Brave and tries to import safari data
  3. Check above full disk access tab modal dialog is shown after import dialog is closed
  4. Check how to url is loaded next to the current settings tab after clicking learn link

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@simonhong simonhong added this to the 1.6.x - Nightly milestone Feb 6, 2020
@simonhong simonhong self-assigned this Feb 6, 2020
@simonhong simonhong force-pushed the issue_2710 branch 2 times, most recently from 69a146b to 6a43b73 Compare February 10, 2020 02:52
void OnJavascriptDisallowed() override;

private:
+ friend class BraveImportDataHandler;
Copy link
Member Author

@simonhong simonhong Feb 10, 2020

Choose a reason for hiding this comment

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

Needed to call ImportDataHandler::StartImport().

@simonhong simonhong marked this pull request as ready for review February 10, 2020 03:06
@simonhong
Copy link
Member Author

simonhong commented Feb 10, 2020

@rebron Can you check the text in the dialog? I referred edge's sentence.

@rebron
Copy link
Collaborator

rebron commented Feb 12, 2020

cc: @tomlowenthal cc: @Brave-Matt on text.

Original:
Full Disk Access required
Brave needs Full Disk Access to import your Bookmarks and History from Safari.
Learn to how to grant Full Disk Access from your System Preferences.

Edited per comment below.
Should read:
Full Disk Access required
Brave needs Full Disk Access to import your Bookmarks and History from Safari.
Learn how to grant Full Disk Access from your System Preferences.

@simonhong
Copy link
Member Author

Text updated.

@tildelowengrimm
Copy link
Contributor

Text seems fine. It's not very explanatory, but maybe it doesn't need to be.

@simonhong
Copy link
Member Author

Kindly ping to reviewers :)

@Brave-Matt
Copy link

Use this help link should point to the Safari section on the support page directly: https://support.brave.com/hc/en-us/articles/360019782291#safari

@bsclifton
Copy link
Member

Verified this shows dialog as expected and the help page has the info needed

Since I'm running locally though, I tried to add src/out/Component/Brave Browser Development.App to this list and it didn't work. Going to debug a bit more. Maybe I should try with stand-alone executable after create_dist

@simonhong
Copy link
Member Author

@Brave-Matt URL is updated. thanks for checking!
@bsclifton Yes, you can see when you install from dmg.

@bsclifton
Copy link
Member

Built locally, verified the modal shows. Also grabbed test DMG from here:
https://bravesoftware.slack.com/archives/CMH8DU4TF/p1581715873050300

Works great! 😄

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

New code and code changes look great to me! Nice patch cleanup and follows patch guidelines. As noted, tested and it works great 😄 Nice job!

@bsclifton
Copy link
Member

cc: @bridiver for patch review

@simonhong simonhong force-pushed the issue_2710 branch 2 times, most recently from 46e84d8 to 24c20e4 Compare February 18, 2020 02:13
@bsclifton
Copy link
Member

@simonhong is it possible to open the panel directly? If so, that would be great 😄 I think the guide link would still be good - as a way to explain what to do once you get there

@simonhong
Copy link
Member Author

@bsclifton We can. @bridiver shared the api :)

#import <AppKit/AppKit.h>

[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"]];

@simonhong
Copy link
Member Author

Tested with two buttons like below.
image

@rebron
Copy link
Collaborator

rebron commented Feb 19, 2020

That looks great.

@kjozwiak
Copy link
Member

Verification PASSED on macOS 10.15.3 x64 using the following build:

Brave 1.7.22 Chromium: 80.0.3987.122 (Official Build) nightly (64-bit)
Revision cf72c4c4f7db75bc3da689cd76513962d31c7b52-refs/branch-heads/3987@{#943}
OS macOS Version 10.15.3 (Build 19D76)
  • ensured that Open System Preferences opened Security & Privacy and Full Disk Access was selected
  • ensured that "Cancel" cancelled the import operation and didn't import any bookmarks from Safari
  • ensured that the Learn how to grant Full Disk Access from your System Preferences text opened https://support.brave.com/hc/en-us/articles/360019782291#safari in a new tab
  • ensured importing worked once Brave received Full Disk Access via Security & Privacy when Safari is closed
  • ensured importing worked once Brave received Full Disk Access via Security & Privacy when Safari is opened

Examples of the above PR working:

Screen Shot 2020-02-27 at 1 54 36 AM

Screen Shot 2020-02-27 at 1 59 40 AM

Screen Shot 2020-02-27 at 2 00 45 AM

Screen Shot 2020-02-27 at 2 01 03 AM

Screen Shot 2020-02-27 at 2 01 22 AM

@kjozwiak
Copy link
Member

kjozwiak commented Feb 27, 2020

@rebron @tomlowenthal Learn to how to grant Full Disk Access from your System Preferences. sounds weird, specifically the Learn to how to part. Should it be the following instead?

Learn how to grant Full Disk Access from your System Preferences.

Either way, just double checking if we're good with Learn to how to grant Full

@rebron
Copy link
Collaborator

rebron commented Feb 27, 2020

@simonhong I made typo error.
Dialog should read

Learn how to grant Full Disk Access from your System Preferences.

I added an extra to by mistake.

@kjozwiak
Copy link
Member

kjozwiak commented Feb 28, 2020

Verification PASSED on macOS 10.15.3 x64 (Catalina) using the following build:

Brave 1.7.28 Chromium: 80.0.3987.122 (Official Build) nightly (64-bit)
Revision cf72c4c4f7db75bc3da689cd76513962d31c7b52-refs/branch-heads/3987@{#943}
OS macOS Version 10.15.3 (Build 19D76)

Text looks much better 👍

Screen Shot 2020-02-28 at 3 48 56 PM

@kjozwiak
Copy link
Member

kjozwiak commented Feb 29, 2020

Looks like we're going to need to edit the text once again. We're currently not importing History from Safari so the above should be using either the following:

  • Bookmarks and Favorites
  • Favorites and Bookmarks

Screen Shot 2020-02-28 at 7 03 32 PM

CCing @rebron to create the follow up issue so we can change the text and decide on the order.

@simonhong
Copy link
Member Author

@kjozwiak Not sure why current safari importer can't import history.
Upstream has that code. maybe upstream bug or blocked by other places.. not sure need to investigate. https://source.chromium.org/chromium/chromium/src/+/master:chrome/common/importer/safari_importer_utils.mm;l=25

@kjozwiak
Copy link
Member

kjozwiak commented Mar 4, 2020

Verification PASSED on macOS 10.15.3 x64 using the following build:

Brave | 1.7.37 Chromium: 80.0.3987.122 (Official Build) nightly (64-bit)
-- | --
Revision | cf72c4c4f7db75bc3da689cd76513962d31c7b52-refs/branch-heads/3987@{#943}
OS | macOS Version 10.15.3 (Build 19D76)

Screen Shot 2020-03-03 at 11 18 19 PM

@simonhong the issue with History not being imported into Brave from Safari will be addressed via brave/brave-browser#8515.

@simonhong
Copy link
Member Author

@kjozwiak Ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing bookmarks from Safari fails
7 participants