Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / first_run / first_run_actor.h
blobe797570a8ebd3eed8e25f4704bfac9c447a99ce9
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_UI_WEBUI_CHROMEOS_FIRST_RUN_FIRST_RUN_ACTOR_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_FIRST_RUN_FIRST_RUN_ACTOR_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
12 namespace base {
13 class DictionaryValue;
16 namespace chromeos {
18 class FirstRunActor {
19 public:
20 class Delegate {
21 public:
22 virtual ~Delegate() {}
24 // Called after actor was initialized.
25 virtual void OnActorInitialized() = 0;
27 // Called when user clicked "Next" button in step with name |step_name|.
28 virtual void OnNextButtonClicked(const std::string& step_name) = 0;
30 // Called when user clicked "Keep exploring" button.
31 virtual void OnHelpButtonClicked() = 0;
33 // Called after step with |step_name| has been shown.
34 virtual void OnStepShown(const std::string& step_name) = 0;
36 // Called after step with |step_name| has been shown.
37 virtual void OnStepHidden(const std::string& step_name) = 0;
39 // Called in answer to Finalize() call.
40 virtual void OnActorFinalized() = 0;
42 // Notifies about about actor destruction.
43 virtual void OnActorDestroyed() = 0;
46 class StepPosition {
47 public:
48 // Initializes fields in "non-set" state.
49 StepPosition();
51 // Setters for properties. Return |*this|.
52 StepPosition& SetTop(int top);
53 StepPosition& SetRight(int right);
54 StepPosition& SetBottom(int bottom);
55 StepPosition& SetLeft(int left);
57 // Returns DictionaryValue containing set properties.
58 scoped_ptr<base::DictionaryValue> AsValue() const;
60 private:
61 int top_;
62 int right_;
63 int bottom_;
64 int left_;
67 FirstRunActor();
68 virtual ~FirstRunActor();
70 // Returns |true| if actor is initialized. Other public methods can be called
71 // only if |IsInitialized| returns |true|.
72 virtual bool IsInitialized() = 0;
74 // Changes background visibility.
75 virtual void SetBackgroundVisible(bool visible) = 0;
77 // Adds rectangular hole to background with given position and dimensions.
78 virtual void AddRectangularHole(int x, int y, int width, int height) = 0;
80 // Adds round hole to background with given position and dimensions.
81 virtual void AddRoundHole(int x, int y, float radius) = 0;
83 // Removes all holes from background.
84 virtual void RemoveBackgroundHoles() = 0;
86 // Shows step with given name and position.
87 virtual void ShowStepPositioned(const std::string& name,
88 const StepPosition& position) = 0;
90 // Shows step with given name that points to given point.
91 virtual void ShowStepPointingTo(const std::string& name,
92 int x,
93 int y,
94 int offset) = 0;
96 // Hides currently shown step.
97 virtual void HideCurrentStep() = 0;
99 // Hides all the UI.
100 virtual void Finalize() = 0;
102 // Whether actor is finalizing now.
103 virtual bool IsFinalizing() = 0;
105 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
106 Delegate* delegate() const { return delegate_; }
108 private:
109 Delegate* delegate_;
112 } // namespace chromeos
114 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_FIRST_RUN_FIRST_RUN_ACTOR_H_