OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 #ifndef CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_ |
| 5 #define CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_ |
| 6 |
| 7 #include "base/basictypes.h" |
| 8 #include "base/timer/timer.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 |
| 11 namespace chromeos { |
| 12 |
| 13 class DriveWebContentsManager; |
| 14 |
| 15 // This class is responsible for kicking off the Google Drive offline |
| 16 // initialization process. There is an initial delay to avoid contention when |
| 17 // the session starts. DriveFirstRunController will manage its own lifetime and |
| 18 // destroy itself when the initialization succeeds or fails. |
| 19 class DriveFirstRunController { |
| 20 public: |
| 21 DriveFirstRunController(); |
| 22 ~DriveFirstRunController(); |
| 23 |
| 24 // Starts the process to enable offline mode for the user's Drive account. |
| 25 void EnableOfflineMode(); |
| 26 |
| 27 private: |
| 28 // Used as a callback to indicate whether the offline initialization |
| 29 // succeeds or fails. |
| 30 void OnOfflineInit(bool success); |
| 31 |
| 32 // Called when timed out waiting for offline initialization to complete. |
| 33 void OnWebContentsTimedOut(); |
| 34 |
| 35 // Cleans up internal state and schedules self for deletion. |
| 36 void CleanUp(); |
| 37 |
| 38 Profile* profile_; |
| 39 scoped_ptr<DriveWebContentsManager> web_contents_manager_; |
| 40 base::OneShotTimer<DriveFirstRunController> web_contents_timer_; |
| 41 base::OneShotTimer<DriveFirstRunController> initial_delay_timer_; |
| 42 bool started_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(DriveFirstRunController); |
| 45 }; |
| 46 |
| 47 } // namespace chromeos |
| 48 |
| 49 #endif // CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_ |
OLD | NEW |