Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Side by Side Diff: trunk/src/chrome/browser/first_run/first_run_posix.cc

Issue 15968002: Revert 201837 "OOP import on Windows." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/message_loop.h"
9 #include "base/path_service.h" 10 #include "base/path_service.h"
10 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/first_run/first_run_dialog.h" 14 #include "chrome/browser/first_run/first_run_dialog.h"
13 #include "chrome/browser/first_run/first_run_internal.h" 15 #include "chrome/browser/first_run/first_run_internal.h"
16 #include "chrome/browser/importer/importer_host.h"
17 #include "chrome/browser/importer/importer_list.h"
14 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
18 #include "chrome/common/startup_metric_utils.h" 22 #include "chrome/common/startup_metric_utils.h"
19 #include "chrome/installer/util/google_update_settings.h" 23 #include "chrome/installer/util/google_update_settings.h"
20 #include "chrome/installer/util/master_preferences.h" 24 #include "chrome/installer/util/master_preferences.h"
25 #include "chrome/installer/util/master_preferences_constants.h"
21 26
22 namespace first_run { 27 namespace first_run {
23 namespace internal { 28 namespace internal {
24 29
25 void DoPostImportPlatformSpecificTasks(Profile* profile) { 30 void DoPostImportPlatformSpecificTasks(Profile* profile) {
26 #if !defined(OS_CHROMEOS) 31 #if !defined(OS_CHROMEOS)
27 // Aura needs a views implementation of the first run dialog for Linux. 32 // Aura needs a views implementation of the first run dialog for Linux.
28 // http://crbug.com/234637 33 // http://crbug.com/234637
29 #if !defined(USE_AURA) 34 #if !defined(USE_AURA)
30 base::FilePath local_state_path; 35 base::FilePath local_state_path;
(...skipping 20 matching lines...) Expand all
51 bool GetFirstRunSentinelFilePath(base::FilePath* path) { 56 bool GetFirstRunSentinelFilePath(base::FilePath* path) {
52 base::FilePath first_run_sentinel; 57 base::FilePath first_run_sentinel;
53 58
54 if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel)) 59 if (!PathService::Get(chrome::DIR_USER_DATA, &first_run_sentinel))
55 return false; 60 return false;
56 61
57 *path = first_run_sentinel.Append(chrome::kFirstRunSentinel); 62 *path = first_run_sentinel.Append(chrome::kFirstRunSentinel);
58 return true; 63 return true;
59 } 64 }
60 65
66 bool ImportSettings(Profile* profile,
67 ImporterHost* importer_host,
68 scoped_refptr<ImporterList> importer_list,
69 int items_to_import) {
70 const importer::SourceProfile& source_profile =
71 importer_list->GetSourceProfileAt(0);
72
73 // Ensure that importers aren't requested to import items that they do not
74 // support. If there is no overlap, skip.
75 items_to_import &= source_profile.services_supported;
76 if (items_to_import == 0)
77 return true;
78
79 ImportEndedObserver observer;
80 importer_host->SetObserver(&observer);
81 importer_host->StartImportSettings(source_profile,
82 profile,
83 items_to_import,
84 new ProfileWriter(profile));
85 // If the import process has not errored out, block on it.
86 if (!observer.ended()) {
87 observer.set_should_quit_message_loop();
88 MessageLoop::current()->Run();
89 }
90
91 // Unfortunately there's no success/fail signal in ImporterHost.
92 return true;
93 }
94
95 void SetImportPreferencesAndLaunchImport(
96 MasterPrefs* out_prefs,
97 installer::MasterPreferences* install_prefs) {
98 std::string import_bookmarks_path;
99 install_prefs->GetString(
100 installer::master_preferences::kDistroImportBookmarksFromFilePref,
101 &import_bookmarks_path);
102 if (!import_bookmarks_path.empty()) {
103 // There are bookmarks to import from a file.
104 base::FilePath path = base::FilePath::FromWStringHack(UTF8ToWide(
105 import_bookmarks_path));
106 if (!ImportBookmarks(path)) {
107 LOG(WARNING) << "silent bookmark import failed";
108 }
109 }
110 }
111
61 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { 112 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) {
62 // The EULA is only handled on Windows. 113 // The EULA is only handled on Windows.
63 return true; 114 return true;
64 } 115 }
65 116
66 } // namespace internal 117 } // namespace internal
67 } // namespace first_run 118 } // namespace first_run
119
120 namespace first_run {
121
122 // TODO(port): Import switches need to be ported to both Mac and Linux. Not all
123 // import switches here are implemented for Linux. None are implemented for Mac
124 // (as this function will not be called on Mac).
125 int ImportNow(Profile* profile, const CommandLine& cmdline) {
126 return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline);
127 }
128
129 } // namespace first_run
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/first_run/first_run_mac.mm ('k') | trunk/src/chrome/browser/first_run/first_run_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698