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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 98 |
97 #if !defined(OS_WIN) | 99 #if !defined(OS_WIN) |
98 bool ImportBookmarks(const base::FilePath& import_bookmarks_path); | 100 bool ImportBookmarks(const base::FilePath& import_bookmarks_path); |
99 #endif | 101 #endif |
100 | 102 |
101 // Shows the EULA dialog if required. Returns true if the EULA is accepted, | 103 // 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 | 104 // returns false if the EULA has not been accepted, in which case the browser |
103 // should exit. | 105 // should exit. |
104 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); | 106 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs); |
105 | 107 |
108 | |
109 // This class acts as an observer for the ImporterProgressObserver::ImportEnded | |
110 // callback. When the import process is started, certain errors may cause | |
111 // ImportEnded() to be called synchronously, but the typical case is that | |
112 // ImportEnded() is called asynchronously. Thus we have to handle both cases. | |
113 // TODO(gab): Move this to the unnamed namespace of first_run.cc as part of the | |
114 // refactoring for OOP import (http://crbug.com/219419). | |
115 class ImportEndedObserver : public importer::ImporterProgressObserver { | |
gab
2013/04/17 02:41:01
Note: This was moved (unmodified) from first_run_p
| |
116 public: | |
117 ImportEndedObserver() : ended_(false), | |
118 should_quit_message_loop_(false) {} | |
119 virtual ~ImportEndedObserver() {} | |
120 | |
121 // importer::ImporterProgressObserver: | |
122 virtual void ImportStarted() OVERRIDE {} | |
123 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} | |
124 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} | |
125 virtual void ImportEnded() OVERRIDE { | |
126 ended_ = true; | |
127 if (should_quit_message_loop_) | |
128 MessageLoop::current()->Quit(); | |
129 } | |
130 | |
131 void set_should_quit_message_loop() { | |
132 should_quit_message_loop_ = true; | |
133 } | |
134 | |
135 bool ended() { | |
136 return ended_; | |
137 } | |
138 | |
139 private: | |
140 // Set if the import has ended. | |
141 bool ended_; | |
142 | |
143 // Set by the client (via set_should_quit_message_loop) if, when the import | |
144 // ends, this class should quit the message loop. | |
145 bool should_quit_message_loop_; | |
146 }; | |
147 | |
106 } // namespace internal | 148 } // namespace internal |
107 } // namespace first_run | 149 } // namespace first_run |
108 | 150 |
109 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ | 151 #endif // CHROME_BROWSER_FIRST_RUN_FIRST_RUN_INTERNAL_H_ |
OLD | NEW |