summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/importer.cc
diff options
context:
space:
mode:
authorbrg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-16 22:59:02 +0000
committerbrg@chromium.com <brg@chromium.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-16 22:59:02 +0000
commit9b7ef69113c8a5c7eb6c1e51af506547c32d6fe4 (patch)
tree6abfdc143b6050a4b0d480baed150260dbdade57 /chrome/browser/importer/importer.cc
parent6256397c0cbb5d88e47676a7414f71669ddc638a (diff)
downloadchromium_src-9b7ef69113c8a5c7eb6c1e51af506547c32d6fe4.zip
chromium_src-9b7ef69113c8a5c7eb6c1e51af506547c32d6fe4.tar.gz
chromium_src-9b7ef69113c8a5c7eb6c1e51af506547c32d6fe4.tar.bz2
Re-introducing the toolbar importer code.This is the same code that was removed in CL http://codereview.chromium.org/18550.The UI will be reworked in a CL immediately following review/submission of this code.Please contact Nick Baum for information regarding this change.
Review URL: http://codereview.chromium.org/66065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer/importer.cc')
-rw-r--r--chrome/browser/importer/importer.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 6e29b59..7710c83 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -22,6 +22,7 @@
#if defined(OS_WIN)
#include "chrome/browser/importer/ie_importer.h"
#endif
+#include "chrome/browser/importer/toolbar_importer.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/tab_contents/site_instance.h"
@@ -512,6 +513,32 @@ void ImporterHost::StartImportSettings(const ProfileInfo& profile_info,
}
}
+ #if defined(OS_WIN)
+ // For google toolbar import, we need the user to log in and store their GAIA
+ // credentials.
+ if (profile_info.browser_type == GOOGLE_TOOLBAR5) {
+ if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) {
+ win_util::MessageBox(
+ NULL,
+ l10n_util::GetString(IDS_IMPORTER_GOOGLE_LOGIN_TEXT).c_str(),
+ L"",
+ MB_OK | MB_TOPMOST);
+
+ GURL url("https://www.google.com/accounts/ServiceLogin");
+ BrowsingInstance* instance = new BrowsingInstance(writer_->GetProfile());
+ SiteInstance* site = instance->GetSiteInstanceForURL(url);
+ Browser* browser = BrowserList::GetLastActive();
+ browser->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
+ site);
+
+ MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
+ this, &ImporterHost::OnLockViewEnd, false));
+
+ is_source_readable_ = false;
+ }
+ }
+#endif
+
// BookmarkModel should be loaded before adding IE favorites. So we observe
// the BookmarkModel if needed, and start the task after it has been loaded.
if ((items & FAVORITES) && !writer_->BookmarkModelIsLoaded()) {
@@ -582,6 +609,8 @@ Importer* ImporterHost::CreateImporterByType(ProfileType type) {
return new Firefox2Importer();
case FIREFOX3:
return new Firefox3Importer();
+ case GOOGLE_TOOLBAR5:
+ return new Toolbar5Importer();
}
NOTREACHED();
return NULL;
@@ -612,6 +641,8 @@ void ImporterHost::DetectSourceProfiles() {
DetectIEProfiles();
DetectFirefoxProfiles();
}
+ // TODO(brg) : Current UI requires win_util.
+ DetectGoogleToolbarProfiles();
#else
DetectFirefoxProfiles();
#endif
@@ -707,3 +738,16 @@ void ImporterHost::DetectFirefoxProfiles() {
source_profiles_.push_back(firefox);
}
}
+
+void ImporterHost::DetectGoogleToolbarProfiles() {
+ if (!FirstRun::IsChromeFirstRun()) {
+ ProfileInfo* google_toolbar = new ProfileInfo();
+ google_toolbar->browser_type = GOOGLE_TOOLBAR5;
+ google_toolbar->description = l10n_util::GetString(
+ IDS_IMPORT_FROM_GOOGLE_TOOLBAR);
+ google_toolbar->source_path.clear();
+ google_toolbar->app_path.clear();
+ google_toolbar->services_supported = FAVORITES;
+ source_profiles_.push_back(google_toolbar);
+ }
+}