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

Side by Side Diff: chrome/browser/first_run/first_run_internal.h

Issue 12670013: Out-of-process import on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extract some more CLs Created 7 years, 8 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 #ifndef CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ 5 #ifndef CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
6 #define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ 6 #define CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/message_loop.h"
15 #include "chrome/browser/importer/importer_progress_observer.h"
16 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
17 15
18 class CommandLine; 16 class CommandLine;
19 class GURL; 17 class GURL;
20 class ImporterHost; 18 class ImporterHost;
21 class ImporterList; 19 class ImporterList;
22 class Profile; 20 class Profile;
23 class ProcessSingleton; 21 class ProcessSingleton;
24 class TemplateURLService; 22 class TemplateURLService;
25 23
(...skipping 11 matching lines...) Expand all
37 35
38 enum FirstRunState { 36 enum FirstRunState {
39 FIRST_RUN_UNKNOWN, // The state is not tested or set yet. 37 FIRST_RUN_UNKNOWN, // The state is not tested or set yet.
40 FIRST_RUN_TRUE, 38 FIRST_RUN_TRUE,
41 FIRST_RUN_FALSE 39 FIRST_RUN_FALSE
42 }; 40 };
43 41
44 // This variable should only be accessed through IsChromeFirstRun(). 42 // This variable should only be accessed through IsChromeFirstRun().
45 extern FirstRunState first_run_; 43 extern FirstRunState first_run_;
46 44
47 // This class acts as an observer for the ImporterProgressObserver::ImportEnded
48 // callback. When the import process is started, certain errors may cause
49 // ImportEnded() to be called synchronously, but the typical case is that
50 // ImportEnded() is called asynchronously. Thus we have to handle both cases.
51 // TODO(gab): Move this to the unnamed namespace of first_run.cc as part of the
52 // refactoring for OOP import (http://crbug.com/219419).
53 class ImportEndedObserver : public importer::ImporterProgressObserver {
54 public:
55 ImportEndedObserver() : ended_(false),
56 should_quit_message_loop_(false) {}
57 virtual ~ImportEndedObserver() {}
58
59 // importer::ImporterProgressObserver:
60 virtual void ImportStarted() OVERRIDE {}
61 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {}
62 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {}
63 virtual void ImportEnded() OVERRIDE;
64
65 void set_should_quit_message_loop() {
66 should_quit_message_loop_ = true;
67 }
68
69 bool ended() const {
70 return ended_;
71 }
72
73 private:
74 // Set if the import has ended.
75 bool ended_;
76
77 // Set by the client (via set_should_quit_message_loop) if, when the import
78 // ends, this class should quit the message loop.
79 bool should_quit_message_loop_;
80 };
81
82 // Loads master preferences from the master preference file into the installer 45 // Loads master preferences from the master preference file into the installer
83 // master preferences. Passes the master preference file path out in 46 // master preferences. Passes the master preference file path out in
84 // master_prefs_path. Returns the pointer to installer::MasterPreferences object 47 // master_prefs_path. Returns the pointer to installer::MasterPreferences object
85 // if successful; otherwise, returns NULL. 48 // if successful; otherwise, returns NULL.
86 installer::MasterPreferences* LoadMasterPrefs(base::FilePath* master_prefs_path) ; 49 installer::MasterPreferences* LoadMasterPrefs(base::FilePath* master_prefs_path) ;
87 50
88 // Copies user preference file to master preference file. Returns true if 51 // Copies user preference file to master preference file. Returns true if
89 // successful. 52 // successful.
90 bool CopyPrefFile(const base::FilePath& user_data_dir, 53 bool CopyPrefFile(const base::FilePath& user_data_dir,
91 const base::FilePath& master_prefs_path); 54 const base::FilePath& master_prefs_path);
(...skipping 11 matching lines...) Expand all
103 66
104 // Gives the full path to the sentinel file. The file might not exist. 67 // Gives the full path to the sentinel file. The file might not exist.
105 // This function has a common implementation on OS_POSIX and a windows specific 68 // This function has a common implementation on OS_POSIX and a windows specific
106 // implementation. 69 // implementation.
107 bool GetFirstRunSentinelFilePath(base::FilePath* path); 70 bool GetFirstRunSentinelFilePath(base::FilePath* path);
108 71
109 // This function has a common implementationin for all non-linux platforms, and 72 // This function has a common implementationin for all non-linux platforms, and
110 // a linux specific implementation. 73 // a linux specific implementation.
111 bool IsOrganicFirstRun(); 74 bool IsOrganicFirstRun();
112 75
113 // Imports settings. This may be done in a separate process depending on the
114 // platform, but it will always block until done. The return value indicates
115 // success.
116 // This functions has a common implementation for OS_POSIX, and a
117 // windows specific implementation.
118 bool ImportSettings(Profile* profile,
gab 2013/04/18 21:51:18 Moved to unnamed namespace
119 scoped_refptr<ImporterHost> importer_host,
120 scoped_refptr<ImporterList> importer_list,
121 int items_to_import);
122
123 // Sets import preferences and launch the import process.
124 void SetImportPreferencesAndLaunchImport(
125 MasterPrefs* out_prefs,
126 installer::MasterPreferences* install_prefs);
127
128 int ImportBookmarkFromFileIfNeeded(Profile* profile,
129 const CommandLine& cmdline);
130
131 #if !defined(OS_WIN)
132 bool ImportBookmarks(const base::FilePath& import_bookmarks_path);
133 #endif
134
135 // Shows the EULA dialog if required. Returns true if the EULA is accepted, 76 // Shows the EULA dialog if required. Returns true if the EULA is accepted,
136 // returns false if the EULA has not been accepted, in which case the browser 77 // returns false if the EULA has not been accepted, in which case the browser
137 // should exit. 78 // should exit.
138 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); 79 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs);
139 80
140 // Returns the path for the master preferences file. 81 // Returns the path for the master preferences file.
141 base::FilePath MasterPrefsPath(); 82 base::FilePath MasterPrefsPath();
142 83
143 } // namespace internal 84 } // namespace internal
144 } // namespace first_run 85 } // namespace first_run
145 86
146 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ 87 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698