Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ | |
| 7 | |
| 8 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" | |
| 9 #include "ui/views/controls/button/button.h" | |
|
Peter Kasting
2013/11/26 22:24:31
Nit: Is this #include necessary? Seems like we co
Greg Billock
2013/11/27 14:22:35
Done.
| |
| 10 | |
| 11 namespace ui { | |
| 12 class MenuModel; | |
| 13 } | |
| 14 | |
| 15 // Modifies the ToolbarButton behavior by allowing the back button | |
| 16 // to extend to the full margin if the toolbar is in a maximized state, | |
| 17 // while keeping the usual margin between the drawn button and the edge | |
| 18 // of the toolbar. This is done by adjusting the theme paint rect used | |
| 19 // in the underlying button, and similarly adjusting the focus border. | |
|
Peter Kasting
2013/11/26 22:24:31
Nit: This comment might be clearer:
A subclass of
Greg Billock
2013/11/27 14:22:35
Sounds good.
| |
| 20 class BackButton : public ToolbarButton { | |
| 21 public: | |
| 22 // Takes ownership of the |model|, which can be null if no menu | |
| 23 // is to be shown. | |
| 24 BackButton(views::ButtonListener* listener, ui::MenuModel* model); | |
| 25 virtual ~BackButton(); | |
| 26 | |
| 27 void SetLeftMargin(int margin); | |
|
Peter Kasting
2013/11/26 22:24:31
Nit: Consider using "start" or "leading" in place
Greg Billock
2013/11/27 14:22:35
Done.
| |
| 28 | |
| 29 protected: | |
| 30 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | |
| 31 | |
| 32 private: | |
| 33 // Any leading margin to be applied. Used when the back button is in | |
| 34 // a maximized state to extend to the full window width. | |
| 35 int margin_left_; | |
| 36 | |
| 37 DISALLOW_COPY_AND_ASSIGN(BackButton); | |
| 38 }; | |
| 39 | |
| 40 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ | |
| OLD | NEW |