Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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_UI_VIEWS_FIRST_RUN_BUBBLE_VIEW_VIEWS_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_VIEW_VIEWS_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "views/bubble/bubble_border.h" | |
| 10 #include "views/bubble/bubble_delegate.h" | |
| 11 #include "views/controls/button/button.h" | |
| 12 #include "views/controls/button/text_button.h" | |
| 13 #include "views/focus/focus_manager.h" | |
| 14 #include "views/widget/widget.h" | |
| 15 | |
| 16 class Profile; | |
| 17 | |
| 18 namespace views { | |
| 19 class ImageButton; | |
| 20 class Label; | |
| 21 class NativeTextButton; | |
| 22 }; | |
| 23 | |
| 24 | |
| 25 // FirstRunBubbleViewBase ------------------------------------------------------ | |
| 26 // Base class for implementations of the first run bubble views. | |
| 27 class FirstRunBubbleViewBase : public views::View, | |
| 28 public views::ButtonListener, | |
| 29 public views::FocusChangeListener { | |
| 30 public: | |
| 31 // Called by FirstRunBubble to request focus for the proper button | |
| 32 // in the FirstRunBubbleView variants when it is shown. | |
| 33 virtual void BubbleShown() = 0; | |
| 34 }; | |
| 35 | |
| 36 // FirstRunBubbleViewViews ----------------------------------------------------- | |
| 37 class FirstRunBubbleViewViews : public views::BubbleDelegateView { | |
| 38 public: | |
| 39 FirstRunBubbleViewViews(Profile* profile, | |
| 40 views::Widget* parent, | |
| 41 const gfx::Rect& position_relative_to, | |
| 42 views::BubbleBorder::ArrowLocation arrow_location); | |
| 43 virtual ~FirstRunBubbleViewViews(); | |
| 44 | |
| 45 // view::BubbleDelegate: | |
| 46 virtual SkColor GetFrameBackgroundColor(); | |
| 47 virtual gfx::Rect GetBounds(); | |
| 48 virtual views::BubbleBorder::ArrowLocation GetFrameArrowLocation(); | |
| 49 virtual views::Widget* GetWidget() OVERRIDE; | |
|
msw
2011/10/13 23:09:22
You shouldn't need to override GetWidget/GetConten
| |
| 50 virtual const views::Widget* GetWidget() const OVERRIDE; | |
| 51 virtual views::View* GetContentsView(); | |
| 52 private: | |
| 53 Profile* profile_; | |
| 54 views::Widget* parent_; | |
| 55 const gfx::Rect position_relative_to_; | |
| 56 views::BubbleBorder::ArrowLocation arrow_location_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleViewViews); | |
| 59 }; | |
| 60 | |
| 61 // FirstRunBubbleView ---------------------------------------------------------- | |
| 62 class FirstRunBubbleView : public FirstRunBubbleViewBase { | |
| 63 public: | |
| 64 FirstRunBubbleView(views::Widget* widget, Profile* profile); | |
| 65 // FirstRunBubbleViewBase: | |
| 66 virtual void BubbleShown(); | |
| 67 | |
| 68 private: | |
| 69 virtual ~FirstRunBubbleView(); | |
| 70 | |
| 71 // Overridden from View: | |
| 72 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
| 73 virtual void Layout(); | |
| 74 virtual gfx::Size GetPreferredSize(); | |
| 75 | |
| 76 // FocusChangeListener: | |
| 77 virtual void FocusWillChange(View* focused_before, View* focused_now); | |
| 78 | |
| 79 private: | |
| 80 views::Widget* widget_; | |
| 81 views::Label* label1_; | |
| 82 views::Label* label2_; | |
| 83 views::Label* label3_; | |
| 84 views::NativeTextButton* change_button_; | |
| 85 views::NativeTextButton* keep_button_; | |
| 86 Profile* profile_; | |
| 87 DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleView); | |
| 88 }; | |
| 89 | |
| 90 // FirstRunOEMBubbleViewViews -------------------------------------------------- | |
| 91 class FirstRunOEMBubbleViewViews : public views::BubbleDelegateView { | |
| 92 public: | |
| 93 FirstRunOEMBubbleViewViews(Profile* profile, | |
| 94 views::Widget* parent, | |
| 95 const gfx::Rect& position_relative_to, | |
| 96 views::BubbleBorder::ArrowLocation arrow_location); | |
| 97 virtual ~FirstRunOEMBubbleViewViews(); | |
| 98 | |
| 99 // view::BubbleDelegate: | |
| 100 virtual SkColor GetFrameBackgroundColor(); | |
| 101 virtual gfx::Rect GetBounds(); | |
| 102 virtual views::BubbleBorder::ArrowLocation GetFrameArrowLocation(); | |
| 103 virtual views::Widget* GetWidget() OVERRIDE; | |
| 104 virtual const views::Widget* GetWidget() const OVERRIDE; | |
| 105 virtual views::View* GetContentsView(); | |
| 106 private: | |
| 107 Profile* profile_; | |
| 108 views::Widget* parent_; | |
| 109 const gfx::Rect position_relative_to_; | |
| 110 views::BubbleBorder::ArrowLocation arrow_location_; | |
| 111 | |
| 112 DISALLOW_COPY_AND_ASSIGN(FirstRunOEMBubbleViewViews); | |
| 113 }; | |
| 114 | |
| 115 // FirstRunOEMBubbleView ------------------------------------------------------ | |
| 116 | |
| 117 class FirstRunOEMBubbleView : public FirstRunBubbleViewBase { | |
| 118 public: | |
| 119 FirstRunOEMBubbleView(views::Widget* widget, Profile* profile); | |
| 120 | |
| 121 // FirstRunBubbleViewBase: | |
| 122 virtual void BubbleShown(); | |
| 123 | |
| 124 private: | |
| 125 virtual ~FirstRunOEMBubbleView(); | |
| 126 | |
| 127 // Overridden from View: | |
| 128 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
| 129 virtual void Layout(); | |
| 130 virtual gfx::Size GetPreferredSize(); | |
| 131 | |
| 132 // FocusChangeListener: | |
| 133 virtual void FocusWillChange(View* focused_before, View* focused_now); | |
| 134 | |
| 135 views::Widget* widget_; | |
| 136 views::Label* label1_; | |
| 137 views::Label* label2_; | |
| 138 views::Label* label3_; | |
| 139 views::ImageButton* close_button_; | |
| 140 Profile* profile_; | |
| 141 | |
| 142 DISALLOW_COPY_AND_ASSIGN(FirstRunOEMBubbleView); | |
| 143 }; | |
| 144 | |
| 145 // FirstRunMinimalBubbleViewViews ---------------------------------------------- | |
| 146 class FirstRunMinimalBubbleViewViews : public views::BubbleDelegateView { | |
| 147 public: | |
| 148 FirstRunMinimalBubbleViewViews( | |
| 149 Profile* profile, | |
| 150 views::Widget* parent, | |
| 151 const gfx::Rect& position_relative_to, | |
| 152 views::BubbleBorder::ArrowLocation arrow_location); | |
| 153 virtual ~FirstRunMinimalBubbleViewViews(); | |
| 154 | |
| 155 // view::BubbleDelegate: | |
| 156 virtual SkColor GetFrameBackgroundColor(); | |
| 157 virtual gfx::Rect GetBounds(); | |
| 158 virtual views::BubbleBorder::ArrowLocation GetFrameArrowLocation(); | |
| 159 virtual views::Widget* GetWidget() OVERRIDE; | |
| 160 virtual const views::Widget* GetWidget() const OVERRIDE; | |
| 161 virtual views::View* GetContentsView(); | |
| 162 private: | |
| 163 Profile* profile_; | |
| 164 views::Widget* parent_; | |
| 165 const gfx::Rect position_relative_to_; | |
| 166 views::BubbleBorder::ArrowLocation arrow_location_; | |
| 167 | |
| 168 DISALLOW_COPY_AND_ASSIGN(FirstRunMinimalBubbleViewViews); | |
| 169 }; | |
| 170 | |
| 171 // FirstRunMinimalBubbleView -------------------------------------------------- | |
| 172 class FirstRunMinimalBubbleView : public FirstRunBubbleViewBase { | |
| 173 public: | |
| 174 FirstRunMinimalBubbleView(views::Widget* widget, Profile* profile); | |
| 175 | |
| 176 // FirstRunBubbleViewBase: | |
| 177 virtual void BubbleShown(); | |
| 178 | |
| 179 private: | |
| 180 virtual ~FirstRunMinimalBubbleView(); | |
| 181 | |
| 182 // Overridden from View: | |
| 183 virtual void ButtonPressed(views::Button* sender, | |
| 184 const views::Event& event) { } | |
| 185 virtual void Layout(); | |
| 186 virtual gfx::Size GetPreferredSize(); | |
| 187 | |
| 188 // FocusChangeListener: | |
| 189 virtual void FocusWillChange(View* focused_before, View* focused_now); | |
| 190 | |
| 191 views::Widget* widget_; | |
| 192 views::Label* label1_; | |
| 193 views::Label* label2_; | |
| 194 Profile* profile_; | |
| 195 | |
| 196 DISALLOW_COPY_AND_ASSIGN(FirstRunMinimalBubbleView); | |
| 197 }; | |
| 198 | |
| 199 #endif // CHROME_BROWSER_UI_VIEWS_FIRST_RUN_BUBBLE_VIEW_VIEWS_H_ | |
| OLD | NEW |