• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
5 #ifndef CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_
6 #define CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_
7 
8 #include <string>
9 
10 #include "base/basictypes.h"
11 #include "base/time/time.h"
12 
13 namespace ash {
14 class FirstRunHelper;
15 }
16 
17 namespace gfx {
18 class Size;
19 }
20 
21 namespace chromeos {
22 
23 class FirstRunActor;
24 
25 namespace first_run {
26 
27 class Step {
28  public:
29   Step(const std::string& name,
30        ash::FirstRunHelper* shell_helper,
31        FirstRunActor* actor);
32   virtual ~Step();
33 
34   // Step shows its content.
35   void Show();
36 
37   // Called before hiding step.
38   void OnBeforeHide();
39 
40   // Called after step has been hidden.
41   void OnAfterHide();
42 
name()43   const std::string& name() const { return name_; }
44 
45  protected:
shell_helper()46   ash::FirstRunHelper* shell_helper() const { return shell_helper_; }
actor()47   FirstRunActor* actor() const { return actor_; }
48   gfx::Size GetOverlaySize() const;
49 
50   // Called from Show method.
51   virtual void DoShow() = 0;
52 
53   // Called from OnBeforeHide. Step implementation could override this method to
54   // react on corresponding event.
DoOnBeforeHide()55   virtual void DoOnBeforeHide() {}
56 
57   // Called from OnAfterHide. Step implementation could override this method to
58   // react on event.
DoOnAfterHide()59   virtual void DoOnAfterHide() {}
60 
61  private:
62   // Records time spent on step to UMA.
63   void RecordCompletion();
64 
65   std::string name_;
66   ash::FirstRunHelper* shell_helper_;
67   FirstRunActor* actor_;
68   base::Time show_time_;
69 
70   DISALLOW_COPY_AND_ASSIGN(Step);
71 };
72 
73 }  // namespace first_run
74 }  // namespace chromeos
75 
76 #endif  // CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_
77 
78