Index: chrome/browser/ui/views/toolbar/back_button.h |
diff --git a/chrome/browser/ui/views/toolbar/back_button.h b/chrome/browser/ui/views/toolbar/back_button.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f40436f9d0b0afa98992e46f1c9bf13430466ae1 |
--- /dev/null |
+++ b/chrome/browser/ui/views/toolbar/back_button.h |
@@ -0,0 +1,40 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ |
+#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ |
+ |
+#include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
+#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.
|
+ |
+namespace ui { |
+class MenuModel; |
+} |
+ |
+// Modifies the ToolbarButton behavior by allowing the back button |
+// to extend to the full margin if the toolbar is in a maximized state, |
+// while keeping the usual margin between the drawn button and the edge |
+// of the toolbar. This is done by adjusting the theme paint rect used |
+// 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.
|
+class BackButton : public ToolbarButton { |
+ public: |
+ // Takes ownership of the |model|, which can be null if no menu |
+ // is to be shown. |
+ BackButton(views::ButtonListener* listener, ui::MenuModel* model); |
+ virtual ~BackButton(); |
+ |
+ 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.
|
+ |
+ protected: |
+ virtual gfx::Rect GetThemePaintRect() const OVERRIDE; |
+ |
+ private: |
+ // Any leading margin to be applied. Used when the back button is in |
+ // a maximized state to extend to the full window width. |
+ int margin_left_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BackButton); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_ |