| 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_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" | 8 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 class MenuModel; | 11 class MenuModel; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 class Border; | 15 class Border; |
| 16 class ButtonListener; | 16 class ButtonListener; |
| 17 } | 17 } |
| 18 | 18 |
| 19 // A subclass of ToolbarButton to allow the back button's hit test region to | 19 // A subclass of ToolbarButton to allow the back button's hit test region to |
| 20 // extend all the way to the start of the toolbar (i.e. the screen edge) in | 20 // extend all the way to the start of the toolbar (i.e. the screen edge) in |
| 21 // maximized mode, to benefit from Fitt's Law. The button images and focus | 21 // maximized mode, to benefit from Fitt's Law. The button images and focus |
| 22 // border are still drawn with the normal square shape. | 22 // border are still drawn with the normal square shape. |
| 23 class BackButton : public ToolbarButton { | 23 class BackButton : public ToolbarButton { |
| 24 public: | 24 public: |
| 25 // Takes ownership of the |model|, which can be null if no menu | 25 // Takes ownership of the |model|, which can be null if no menu |
| 26 // is to be shown. | 26 // is to be shown. |
| 27 BackButton(views::ButtonListener* listener, ui::MenuModel* model); | 27 BackButton(Profile* profile, |
| 28 views::ButtonListener* listener, |
| 29 ui::MenuModel* model); |
| 28 ~BackButton() override; | 30 ~BackButton() override; |
| 29 | 31 |
| 30 // Sets |margin_leading_| when the browser is maximized and updates layout | 32 // Sets |margin_leading_| when the browser is maximized and updates layout |
| 31 // to make the focus rectangle centered. | 33 // to make the focus rectangle centered. |
| 32 void SetLeadingMargin(int margin); | 34 void SetLeadingMargin(int margin); |
| 33 | 35 |
| 34 protected: | 36 protected: |
| 35 // ToolbarButton: | 37 // ToolbarButton: |
| 36 gfx::Point CalculateInkDropCenter() const override; | 38 gfx::Point CalculateInkDropCenter() const override; |
| 37 | 39 |
| 38 private: | 40 private: |
| 39 // ToolbarButton: | 41 // ToolbarButton: |
| 40 const char* GetClassName() const override; | 42 const char* GetClassName() const override; |
| 41 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; | 43 scoped_ptr<views::LabelButtonBorder> CreateDefaultBorder() const override; |
| 42 gfx::Rect GetThemePaintRect() const override; | 44 gfx::Rect GetThemePaintRect() const override; |
| 43 | 45 |
| 44 // Any leading margin to be applied. Used when the back button is in | 46 // Any leading margin to be applied. Used when the back button is in |
| 45 // a maximized state to extend to the full window width. | 47 // a maximized state to extend to the full window width. |
| 46 int margin_leading_; | 48 int margin_leading_; |
| 47 | 49 |
| 48 DISALLOW_COPY_AND_ASSIGN(BackButton); | 50 DISALLOW_COPY_AND_ASSIGN(BackButton); |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ | 53 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ |
| OLD | NEW |