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

Unified Diff: chrome/browser/first_run/first_run_internal.h

Issue 14322002: Remove unused ImportProgressDialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/first_run/first_run_internal.h
diff --git a/chrome/browser/first_run/first_run_internal.h b/chrome/browser/first_run/first_run_internal.h
index 000874c7447c846af8fd0b92e9f8048b5c16738b..f5108f235b553fc5ef342efd2589c3b5c54cad1d 100644
--- a/chrome/browser/first_run/first_run_internal.h
+++ b/chrome/browser/first_run/first_run_internal.h
@@ -11,6 +11,8 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
+#include "base/message_loop.h"
+#include "chrome/browser/importer/importer_progress_observer.h"
#include "ui/gfx/native_widget_types.h"
class CommandLine;
@@ -103,6 +105,46 @@ bool ImportBookmarks(const base::FilePath& import_bookmarks_path);
// should exit.
bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs);
+
+// This class acts as an observer for the ImporterProgressObserver::ImportEnded
+// callback. When the import process is started, certain errors may cause
+// ImportEnded() to be called synchronously, but the typical case is that
+// ImportEnded() is called asynchronously. Thus we have to handle both cases.
+// TODO(gab): Move this to the unnamed namespace of first_run.cc as part of the
+// refactoring for OOP import (http://crbug.com/219419).
+class ImportEndedObserver : public importer::ImporterProgressObserver {
gab 2013/04/17 02:41:01 Note: This was moved (unmodified) from first_run_p
+ public:
+ ImportEndedObserver() : ended_(false),
+ should_quit_message_loop_(false) {}
+ virtual ~ImportEndedObserver() {}
+
+ // importer::ImporterProgressObserver:
+ virtual void ImportStarted() OVERRIDE {}
+ virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {}
+ virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {}
+ virtual void ImportEnded() OVERRIDE {
+ ended_ = true;
+ if (should_quit_message_loop_)
+ MessageLoop::current()->Quit();
+ }
+
+ void set_should_quit_message_loop() {
+ should_quit_message_loop_ = true;
+ }
+
+ bool ended() {
+ return ended_;
+ }
+
+ private:
+ // Set if the import has ended.
+ bool ended_;
+
+ // Set by the client (via set_should_quit_message_loop) if, when the import
+ // ends, this class should quit the message loop.
+ bool should_quit_message_loop_;
+};
+
} // namespace internal
} // namespace first_run

Powered by Google App Engine
This is Rietveld 408576698