| 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
|
| index 65b3a496b989f1e0f8564d1e37af4e67585cfc34..47247eeddf3ff9a08a95b7a32db74d003ecd802c 100644
|
| --- a/chrome/browser/chromeos/first_run/drive_first_run_controller.h
|
| +++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.h
|
| @@ -5,6 +5,7 @@
|
| #define CHROME_BROWSER_CHROMEOS_FIRST_RUN_DRIVE_FIRST_RUN_CONTROLLER_H_
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/observer_list.h"
|
| #include "base/timer/timer.h"
|
| #include "chrome/browser/profiles/profile.h"
|
|
|
| @@ -18,12 +19,37 @@ class DriveWebContentsManager;
|
| // destroy itself when the initialization succeeds or fails.
|
| class DriveFirstRunController {
|
| public:
|
| + class Observer {
|
| + public:
|
| + // Called when enabling offline mode times out. OnCompletion will be called
|
| + // immediately afterwards.
|
| + virtual void OnTimedOut() = 0;
|
| +
|
| + // Called when the first run flow finishes, informing the observer of
|
| + // success or failure.
|
| + virtual void OnCompletion(bool success) = 0;
|
| +
|
| + protected:
|
| + virtual ~Observer() {}
|
| + };
|
| +
|
| DriveFirstRunController();
|
| ~DriveFirstRunController();
|
|
|
| // Starts the process to enable offline mode for the user's Drive account.
|
| void EnableOfflineMode();
|
|
|
| + // Manages observers of the first run flow.
|
| + void AddObserver(Observer* observer);
|
| + void RemoveObserver(Observer* observer);
|
| +
|
| + // Set delay times for testing purposes.
|
| + void SetDelaysForTest(int initial_delay_secs, int timeout_secs);
|
| +
|
| + // Set the app id and endpoint url for testing purposes.
|
| + void SetAppInfoForTest(const std::string& app_id,
|
| + const std::string& endpoint_url);
|
| +
|
| private:
|
| // Used as a callback to indicate whether the offline initialization
|
| // succeeds or fails.
|
| @@ -40,6 +66,12 @@ class DriveFirstRunController {
|
| base::OneShotTimer<DriveFirstRunController> web_contents_timer_;
|
| base::OneShotTimer<DriveFirstRunController> initial_delay_timer_;
|
| bool started_;
|
| + ObserverList<Observer> observer_list_;
|
| +
|
| + int initial_delay_secs_;
|
| + int web_contents_timeout_secs_;
|
| + std::string drive_offline_endpoint_url_;
|
| + std::string drive_hosted_app_id_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DriveFirstRunController);
|
| };
|
|
|