OLD | NEW |
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" |
14 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
15 | 17 |
16 class CommandLine; | 18 class CommandLine; |
17 class GURL; | 19 class GURL; |
18 class ImporterHost; | 20 class ImporterHost; |
19 class ImporterList; | 21 class ImporterList; |
20 class Profile; | 22 class Profile; |
21 class ProcessSingleton; | 23 class ProcessSingleton; |
22 class TemplateURLService; | 24 class TemplateURLService; |
23 | 25 |
(...skipping 10 matching lines...) Expand all Loading... |
34 | 36 |
35 enum FirstRunState { | 37 enum FirstRunState { |
36 FIRST_RUN_UNKNOWN, // The state is not tested or set yet. | 38 FIRST_RUN_UNKNOWN, // The state is not tested or set yet. |
37 FIRST_RUN_TRUE, | 39 FIRST_RUN_TRUE, |
38 FIRST_RUN_FALSE | 40 FIRST_RUN_FALSE |
39 }; | 41 }; |
40 | 42 |
41 // This variable should only be accessed through IsChromeFirstRun(). | 43 // This variable should only be accessed through IsChromeFirstRun(). |
42 extern FirstRunState first_run_; | 44 extern FirstRunState first_run_; |
43 | 45 |
| 46 // This class acts as an observer for the ImporterProgressObserver::ImportEnded |
| 47 // callback. When the import process is started, certain errors may cause |
| 48 // ImportEnded() to be called synchronously, but the typical case is that |
| 49 // ImportEnded() is called asynchronously. Thus we have to handle both cases. |
| 50 // TODO(gab): Move this to the unnamed namespace of first_run.cc as part of the |
| 51 // refactoring for OOP import (http://crbug.com/219419). |
| 52 class ImportEndedObserver : public importer::ImporterProgressObserver { |
| 53 public: |
| 54 ImportEndedObserver() : ended_(false), |
| 55 should_quit_message_loop_(false) {} |
| 56 virtual ~ImportEndedObserver() {} |
| 57 |
| 58 // importer::ImporterProgressObserver: |
| 59 virtual void ImportStarted() OVERRIDE {} |
| 60 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} |
| 61 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} |
| 62 virtual void ImportEnded() OVERRIDE; |
| 63 |
| 64 void set_should_quit_message_loop() { |
| 65 should_quit_message_loop_ = true; |
| 66 } |
| 67 |
| 68 bool ended() const { |
| 69 return ended_; |
| 70 } |
| 71 |
| 72 private: |
| 73 // Set if the import has ended. |
| 74 bool ended_; |
| 75 |
| 76 // Set by the client (via set_should_quit_message_loop) if, when the import |
| 77 // ends, this class should quit the message loop. |
| 78 bool should_quit_message_loop_; |
| 79 }; |
| 80 |
44 // Loads master preferences from the master preference file into the installer | 81 // Loads master preferences from the master preference file into the installer |
45 // master preferences. Passes the master preference file path out in | 82 // master preferences. Passes the master preference file path out in |
46 // master_prefs_path. Returns the pointer to installer::MasterPreferences object | 83 // master_prefs_path. Returns the pointer to installer::MasterPreferences object |
47 // if successful; otherwise, returns NULL. | 84 // if successful; otherwise, returns NULL. |
48 installer::MasterPreferences* LoadMasterPrefs(base::FilePath* master_prefs_path)
; | 85 installer::MasterPreferences* LoadMasterPrefs(base::FilePath* master_prefs_path)
; |
49 | 86 |
50 // Copies user preference file to master preference file. Returns true if | 87 // Copies user preference file to master preference file. Returns true if |
51 // successful. | 88 // successful. |
52 bool CopyPrefFile(const base::FilePath& user_data_dir, | 89 bool CopyPrefFile(const base::FilePath& user_data_dir, |
53 const base::FilePath& master_prefs_path); | 90 const base::FilePath& master_prefs_path); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 137 |
101 // Shows the EULA dialog if required. Returns true if the EULA is accepted, | 138 // Shows the EULA dialog if required. Returns true if the EULA is accepted, |
102 // returns false if the EULA has not been accepted, in which case the browser | 139 // returns false if the EULA has not been accepted, in which case the browser |
103 // should exit. | 140 // should exit. |
104 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); | 141 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); |
105 | 142 |
106 } // namespace internal | 143 } // namespace internal |
107 } // namespace first_run | 144 } // namespace first_run |
108 | 145 |
109 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ | 146 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ |
OLD | NEW |