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.
5 #ifndef CHROME_BROWSER_CHROMEOS_FIRST_RUN_FIRST_RUN_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_FIRST_RUN_FIRST_RUN_CONTROLLER_H_
11 #include "ash/first_run/first_run_helper.h"
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "base/compiler_specific.h"
15 #include "base/memory/linked_ptr.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/time/time.h"
18 #include "chrome/browser/ui/webui/chromeos/first_run/first_run_actor.h"
28 class FirstRunUIBrowserTest
;
34 // FirstRunController creates and manages first-run tutorial.
35 // Object manages its lifetime and deletes itself after completion of the
37 class FirstRunController
: public FirstRunActor::Delegate
,
38 public ash::FirstRunHelper::Observer
{
39 typedef std::vector
<linked_ptr
<first_run::Step
> > Steps
;
42 ~FirstRunController() override
;
44 // Creates first-run UI and starts tutorial.
47 // Finalizes first-run tutorial and destroys UI.
51 friend class FirstRunUIBrowserTest
;
57 static FirstRunController
* GetInstanceForTest();
59 // Overriden from FirstRunActor::Delegate.
60 void OnActorInitialized() override
;
61 void OnNextButtonClicked(const std::string
& step_name
) override
;
62 void OnHelpButtonClicked() override
;
63 void OnStepShown(const std::string
& step_name
) override
;
64 void OnStepHidden(const std::string
& step_name
) override
;
65 void OnActorFinalized() override
;
66 void OnActorDestroyed() override
;
68 // Overriden from ash::FirstRunHelper::Observer.
69 void OnCancelled() override
;
74 first_run::Step
* GetCurrentStep() const;
76 // The object providing interface to UI layer. It's not directly owned by
77 // FirstRunController.
78 FirstRunActor
* actor_
;
80 // Helper for manipulating and retreiving information from Shell.
81 scoped_ptr
<ash::FirstRunHelper
> shell_helper_
;
83 // List of all tutorial steps.
86 // Index of step that is currently shown.
87 size_t current_step_index_
;
89 // Profile used for webui and help app.
90 Profile
* user_profile_
;
92 // The work that should be made after actor has been finalized.
93 base::Closure on_actor_finalized_
;
95 // Web contents of WebUI.
96 content::WebContents
* web_contents_for_tests_
;
98 // Time when tutorial was started.
99 base::Time start_time_
;
101 DISALLOW_COPY_AND_ASSIGN(FirstRunController
);
104 } // namespace chromeos
106 #endif // CHROME_BROWSER_CHROMEOS_FIRST_RUN_FIRST_RUN_CONTROLLER_H_