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 from Chrome #49

Merged
merged 6 commits into from
Mar 15, 2018
Merged

Import from Chrome #49

merged 6 commits into from
Mar 15, 2018

Conversation

garrettr
Copy link
Contributor

@garrettr garrettr commented Mar 2, 2018

⚠️ Work in progress! Not ready for merge. ⚠️

The goal of this PR is to port the "Import from Chrome" feature from Brave/Muon to the Chromium fork.

I'm sharing my work-in-progress branch to facilitate review and discussion of my approach so far (per discussion with @bbondy). I started by simplifying the feature to only support importing history and bookmarks from Chrome (per suggestion from @darkdh). I have successfully manually tested importing history and bookmarks from Chrome on macOS with this PR.

Remaining work:

  • Fix importing favicons from Chrome (appears to be broken in Muon as well)
  • Fix importing bookmarks into an empty profile.
  • Tests
  • Manually test on Windows and Linux

Garrett Robinson added 4 commits March 14, 2018 16:00
- Fix incorrect propagation of is_in_toolbar flag
- Only add ImportedBookmarkEntry for folders if they're empty

Importing bookmarks from Chrome now conforms to the behavior described
in the comment for ProfileWriter::AddBookmarks:
https://cs.chromium.org/chromium/src/chrome/browser/importer/profile_writer.h?l=56-73&rcl=219101ecc0143651567d49340e80fb5b3e756b40
@garrettr
Copy link
Contributor Author

Rebased after moving the groundwork for the tests into #57. Once my local rebuild is done, I will check that this is ready for review by @darkdh, e.g. it builds on macOS and it passes both automated and manual testing. I will also test on Windows and Linux. Additional data import types, e.g. cookies and saved passwords, will be implemented in another PR.

@garrettr
Copy link
Contributor Author

This is ready for review on macOS. To test:

  1. yarn start. Go to the Brave menu and choose Import Bookmarks and Settings. Choose a Chrome profile to import. Check Bookmarks and History to verify that they were imported correctly.
  2. yarn test brave_unit_tests

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

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

we should prompt users to close Chrome because History sqlite file will get locked while Chrome is opened. And when that happened, nothing will be imported.

reference FirefoxProfileLock
and we can check SingletonLock under user folder on Mac and Linux
and lockfile under user folder on Windows

you can do this as follow up

@garrettr
Copy link
Contributor Author

you can do this as follow up

@darkdh I filed https://github.com/brave/brave/issues/103. Is this PR ok to merge otherwise?

@@ -0,0 +1,73 @@
// Copyright (c) 2016 GitHub, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should change the license to MPL-2.0

class ListValue;
}

base::FilePath GetChromeUserDataFolder();
Copy link
Member

Choose a reason for hiding this comment

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

}
}

void ChromeImporter::LoadFaviconData(
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

this can be a follow-up too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

// Folders are added implicitly on adding children, so we only
// explicitly add empty folders.
const base::ListValue* children;
if (dict->GetList("children", &children) && children->empty()) {
Copy link
Member

Choose a reason for hiding this comment

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

don't back port this to muon because muon uses different profile writer

@garrettr
Copy link
Contributor Author

@darkdh I changed all of the .cc/.h license headers to MPL and ported the additional support for importing from Chromium and Chrome Canary from Muon. Re-review?

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

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

Awesome!!!
lgtm now. Would you mind squash the commits?
Then I will merge it.

@garrettr
Copy link
Contributor Author

@darkdh Why not just use the "squash and merge" option in the "Merge pull request" dropdown?

@bbondy
Copy link
Member

bbondy commented Mar 17, 2018

For future reference I prefer to not squash and keep commit history more granular, unless it's a messy log, then move to squash and merge. Thanks.

Nice work on getting this landed! Thanks for reviewing Anthony!

NejcZdovc pushed a commit that referenced this pull request Dec 10, 2018
remove more platform specific code
@mihaiplesa mihaiplesa deleted the chrome-importer branch February 9, 2019 12:24
NejcZdovc pushed a commit that referenced this pull request Mar 6, 2019
add support for getting user model and schema data from non-filesyste…
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.

3 participants