Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1241)

Unified Diff: chrome/browser/ui/views/toolbar/back_button.h

Issue 62873007: [Toolbar] Base toolbar button class with background images for button states (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: overriding Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/back_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..99a40940a41035ea6516ffcb0b709acee6120922
--- /dev/null
+++ b/chrome/browser/ui/views/toolbar/back_button.h
@@ -0,0 +1,42 @@
+// 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"
+
+namespace ui {
+class MenuModel;
+}
+
+namespace views {
+class ButtonListener;
+}
+
+// A subclass of ToolbarButton to allow the back button's hittest region to
+// extend all the way to the start of the toolbar (i.e. the screen edge) in
+// maximized mode, to benefit from Fitt's Law. The button images and focus
+// border are still drawn with the normal square shape.
+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 SetLeadingMargin(int margin);
+
+ 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_leading_;
+
+ DISALLOW_COPY_AND_ASSIGN(BackButton);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BACK_BUTTON_H_
« no previous file with comments | « no previous file | chrome/browser/ui/views/toolbar/back_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698