summaryrefslogtreecommitdiffstats
path: root/chrome/browser/first_run_win.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-01 00:24:47 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-01 00:24:47 +0000
commit272709caf9f9d7acef4f2f9f8f0f530d21906181 (patch)
tree36d73e17df90a2139ec7e42bfd7678810120c972 /chrome/browser/first_run_win.cc
parent5315c179ef524c020ecf793fbb9d2b26637cb36d (diff)
downloadchromium_src-272709caf9f9d7acef4f2f9f8f0f530d21906181.zip
chromium_src-272709caf9f9d7acef4f2f9f8f0f530d21906181.tar.gz
chromium_src-272709caf9f9d7acef4f2f9f8f0f530d21906181.tar.bz2
Port the option to import bookmarks from a file to Linux
- Call ImportNow from browser_main.cc - Move necessary functions and a class from first_run_win.cc to first_run.cc and update first_run.h accordingly. - Add some #defines for different OSes and some TODO(port) comments. These changes will allow the use of the --import-from-file option to import bookmarks from a file at first run. I have built and tested this on Linux and Windows. BUG=32728 TEST=run with --import-from-file Patch from Brian G. Merrell <bgmerrell@gmail.com> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=43277 Review URL: http://codereview.chromium.org/1515004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43294 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run_win.cc')
-rw-r--r--chrome/browser/first_run_win.cc79
1 files changed, 1 insertions, 78 deletions
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index 0e0925d..0620baa 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -569,43 +569,6 @@ class HungImporterMonitor : public WorkerThreadTicker::Callback {
DISALLOW_COPY_AND_ASSIGN(HungImporterMonitor);
};
-// This class is used by FirstRun::ImportNow to get notified of the outcome of
-// the import operation. It differs from ImportProcessRunner in that this
-// class executes in the context of importing child process.
-// The values that it handles are meant to be used as the process exit code.
-class FirstRunImportObserver : public ImportObserver {
- public:
- FirstRunImportObserver()
- : loop_running_(false), import_result_(ResultCodes::NORMAL_EXIT) {
- }
- int import_result() const {
- return import_result_;
- }
- virtual void ImportCanceled() {
- import_result_ = ResultCodes::IMPORTER_CANCEL;
- Finish();
- }
- virtual void ImportComplete() {
- import_result_ = ResultCodes::NORMAL_EXIT;
- Finish();
- }
-
- void RunLoop() {
- loop_running_ = true;
- MessageLoop::current()->Run();
- }
-
- private:
- void Finish() {
- if (loop_running_)
- MessageLoop::current()->Quit();
- }
-
- bool loop_running_;
- int import_result_;
- DISALLOW_COPY_AND_ASSIGN(FirstRunImportObserver);
-};
-
std::wstring EncodeImportParams(int browser_type, int options, HWND window) {
return StringPrintf(L"%d@%d@%d", browser_type, options, window);
}
@@ -693,34 +656,6 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type,
std::wstring(), parent_window);
}
-int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) {
- std::wstring file_path = cmdline.GetSwitchValue(switches::kImportFromFile);
- if (file_path.empty()) {
- NOTREACHED();
- return false;
- }
- scoped_refptr<ImporterHost> importer_host = new ImporterHost();
- FirstRunImportObserver observer;
-
- importer_host->set_headless();
-
- ProfileInfo profile_info;
- profile_info.browser_type = importer::BOOKMARKS_HTML;
- profile_info.source_path = file_path;
-
- StartImportingWithUI(
- NULL,
- importer::FAVORITES,
- importer_host,
- profile_info,
- profile,
- &observer,
- true);
-
- observer.RunLoop();
- return observer.import_result();
-}
-
int FirstRun::ImportFromBrowser(Profile* profile,
const CommandLine& cmdline) {
std::wstring import_info = cmdline.GetSwitchValue(switches::kImport);
@@ -757,19 +692,6 @@ int FirstRun::ImportFromBrowser(Profile* profile,
return observer.import_result();
}
-int FirstRun::ImportNow(Profile* profile, const CommandLine& cmdline) {
- int return_code = true;
- if (cmdline.HasSwitch(switches::kImportFromFile)) {
- // Silently import preset bookmarks from file.
- // This is an OEM scenario.
- return_code = ImportFromFile(profile, cmdline);
- }
- if (cmdline.HasSwitch(switches::kImport)) {
- return_code = ImportFromBrowser(profile, cmdline);
- }
- return return_code;
-}
-
//////////////////////////////////////////////////////////////////////////
namespace {
@@ -1046,3 +968,4 @@ Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
TryChromeDialog td;
return td.ShowModal();
}
+