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

Unified Diff: chrome/browser/chromeos/first_run/drive_first_run_controller.h

Issue 55423004: Enable Google Drive offline mode automatically on first run. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/first_run/drive_first_run_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/first_run/drive_first_run_controller.h
diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.h b/chrome/browser/chromeos/first_run/drive_first_run_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..65b3a496b989f1e0f8564d1e37af4e67585cfc34
--- /dev/null
+++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.h
@@ -0,0 +1,49 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#ifndef CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_
+#define CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_
+
+#include "base/basictypes.h"
+#include "base/timer/timer.h"
+#include "chrome/browser/profiles/profile.h"
+
+namespace chromeos {
+
+class DriveWebContentsManager;
+
+// This class is responsible for kicking off the Google Drive offline
+// initialization process. There is an initial delay to avoid contention when
+// the session starts. DriveFirstRunController will manage its own lifetime and
+// destroy itself when the initialization succeeds or fails.
+class DriveFirstRunController {
+ public:
+ DriveFirstRunController();
+ ~DriveFirstRunController();
+
+ // Starts the process to enable offline mode for the user's Drive account.
+ void EnableOfflineMode();
+
+ private:
+ // Used as a callback to indicate whether the offline initialization
+ // succeeds or fails.
+ void OnOfflineInit(bool success);
+
+ // Called when timed out waiting for offline initialization to complete.
+ void OnWebContentsTimedOut();
+
+ // Cleans up internal state and schedules self for deletion.
+ void CleanUp();
+
+ Profile* profile_;
+ scoped_ptr<DriveWebContentsManager> web_contents_manager_;
+ base::OneShotTimer<DriveFirstRunController> web_contents_timer_;
+ base::OneShotTimer<DriveFirstRunController> initial_delay_timer_;
+ bool started_;
+
+ DISALLOW_COPY_AND_ASSIGN(DriveFirstRunController);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_
« no previous file with comments | « no previous file | chrome/browser/chromeos/first_run/drive_first_run_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698