| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/time/time.h" |
| 11 | 12 |
| 12 namespace ash { | 13 namespace ash { |
| 13 class FirstRunHelper; | 14 class FirstRunHelper; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace gfx { | 17 namespace gfx { |
| 17 class Size; | 18 class Size; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace chromeos { | 21 namespace chromeos { |
| 21 | 22 |
| 22 class FirstRunActor; | 23 class FirstRunActor; |
| 23 | 24 |
| 24 namespace first_run { | 25 namespace first_run { |
| 25 | 26 |
| 26 class Step { | 27 class Step { |
| 27 public: | 28 public: |
| 28 Step(const std::string& name, | 29 Step(const std::string& name, |
| 29 ash::FirstRunHelper* shell_helper, | 30 ash::FirstRunHelper* shell_helper, |
| 30 FirstRunActor* actor); | 31 FirstRunActor* actor); |
| 31 virtual ~Step(); | 32 virtual ~Step(); |
| 32 | 33 |
| 33 // Step shows its content. | 34 // Step shows its content. |
| 34 virtual void Show() = 0; | 35 void Show(); |
| 35 | 36 |
| 36 // Called before hiding step. Default implementation removes holes from | 37 // Called before hiding step. |
| 37 // background. | 38 void OnBeforeHide(); |
| 38 virtual void OnBeforeHide(); | |
| 39 | 39 |
| 40 // Called after step has been hidden. | 40 // Called after step has been hidden. |
| 41 virtual void OnAfterHide(); | 41 void OnAfterHide(); |
| 42 | |
| 43 // Returns size of overlay window. | |
| 44 gfx::Size GetOverlaySize() const; | |
| 45 | 42 |
| 46 const std::string& name() const { return name_; } | 43 const std::string& name() const { return name_; } |
| 47 | 44 |
| 48 protected: | 45 protected: |
| 49 ash::FirstRunHelper* shell_helper() const { return shell_helper_; } | 46 ash::FirstRunHelper* shell_helper() const { return shell_helper_; } |
| 50 FirstRunActor* actor() const { return 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. |
| 55 virtual void DoOnBeforeHide() {} |
| 56 |
| 57 // Called from OnAfterHide. Step implementation could override this method to |
| 58 // react on event. |
| 59 virtual void DoOnAfterHide() {} |
| 51 | 60 |
| 52 private: | 61 private: |
| 62 // Records time spent on step to UMA. |
| 63 void RecordCompletion(); |
| 64 |
| 53 std::string name_; | 65 std::string name_; |
| 54 ash::FirstRunHelper* shell_helper_; | 66 ash::FirstRunHelper* shell_helper_; |
| 55 FirstRunActor* actor_; | 67 FirstRunActor* actor_; |
| 68 base::Time show_time_; |
| 56 | 69 |
| 57 DISALLOW_COPY_AND_ASSIGN(Step); | 70 DISALLOW_COPY_AND_ASSIGN(Step); |
| 58 }; | 71 }; |
| 59 | 72 |
| 60 } // namespace first_run | 73 } // namespace first_run |
| 61 } // namespace chromeos | 74 } // namespace chromeos |
| 62 | 75 |
| 63 #endif // CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_ | 76 #endif // CHROME_BROWSER_CHROMEOS_FIRST_RUN_STEP_H_ |
| 64 | 77 |
| OLD | NEW |