Chromium Code Reviews| Index: chrome/browser/ui/views/toolbar/toolbar_button.h |
| diff --git a/ui/views/controls/button/button_dropdown.h b/chrome/browser/ui/views/toolbar/toolbar_button.h |
| similarity index 62% |
| copy from ui/views/controls/button/button_dropdown.h |
| copy to chrome/browser/ui/views/toolbar/toolbar_button.h |
| index f0a18faeebe3b309c34eaa5f8772ae83f509f933..6eaea114be60706c8e93b6201ac4e0c1b54ab5f0 100644 |
| --- a/ui/views/controls/button/button_dropdown.h |
| +++ b/chrome/browser/ui/views/toolbar/toolbar_button.h |
| @@ -1,51 +1,49 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2012 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 UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| -#define UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| +#ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| +#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |
| -#include "base/memory/weak_ptr.h" |
| +#include "ui/views/controls/button/label_button.h" |
| #include "ui/views/context_menu_controller.h" |
| -#include "ui/views/controls/button/image_button.h" |
| +#include "ui/views/controls/button/button.h" |
| namespace ui { |
| class MenuModel; |
| } |
| namespace views { |
| - |
| class MenuRunner; |
| +} |
| -//////////////////////////////////////////////////////////////////////////////// |
| -// |
| -// ButtonDropDown |
| -// |
| -// A button class that when pressed (and held) or pressed (and drag down) will |
| -// display a menu |
| -// |
| -//////////////////////////////////////////////////////////////////////////////// |
| -class VIEWS_EXPORT ButtonDropDown : public ImageButton, |
| - public ContextMenuController { |
| +// This class provides basic drawing and mouse-over behavior for buttons |
| +// appearing in the toolbar. |
| +// See ButtonDropDown. |
|
Peter Kasting
2013/11/15 03:28:58
ButtonDropDown no longer exists, AFAICT.
Greg Billock
2013/11/15 19:36:50
ui/views/controls/button/button_dropdown.h still e
Peter Kasting
2013/11/15 22:11:56
My guiding principle is "scope things narrowly", s
|
| +class ToolbarButton : public views::LabelButton, |
|
Peter Kasting
2013/11/15 03:28:58
Would we also make the "wrench" button (as it's st
Greg Billock
2013/11/15 19:36:50
Yes. I only did the one here to make sure we have
Peter Kasting
2013/11/15 22:11:56
K. Either way is OK, whatever ends up being simpl
|
| + public views::ButtonListener, |
| + public views::ContextMenuController { |
| public: |
| - // The button's class name. |
| - static const char kViewClassName[]; |
| + // Takes ownership of the |model|, which can be null if no menu |
| + // is to be shown. |
| + ToolbarButton(ui::MenuModel* model); |
| + virtual ~ToolbarButton(); |
| - // Takes ownership of the |model|. |
| - ButtonDropDown(ButtonListener* listener, ui::MenuModel* model); |
| - virtual ~ButtonDropDown(); |
| + // Set up basic behavior. Should be called by any subclasses. |
| + void Init(); |
| - // If menu is currently pending for long press - stop it. |
| - void ClearPendingMenu(); |
| + // views::ButtonListener. Default implementation does nothing. |
| + virtual void ButtonPressed(views::Button* sender, |
| + const ui::Event& event) OVERRIDE; |
| - // Indicates if menu is currently showing. |
| + // Methods for handling ButtonDropDown-style menus. |
| + void ClearPendingMenu(); |
| bool IsMenuShowing() const; |
| // Overridden from views::View |
| virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| - virtual const char* GetClassName() const OVERRIDE; |
| // Showing the drop down results in a MouseCaptureLost, we need to ignore it. |
| virtual void OnMouseCaptureLost() OVERRIDE {} |
| virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| @@ -81,14 +79,12 @@ class VIEWS_EXPORT ButtonDropDown : public ImageButton, |
| int y_position_on_lbuttondown_; |
| // Menu runner to display drop down menu. |
| - scoped_ptr<MenuRunner> menu_runner_; |
| + scoped_ptr<views::MenuRunner> menu_runner_; |
| // A factory for tasks that show the dropdown context menu for the button. |
| - base::WeakPtrFactory<ButtonDropDown> show_menu_factory_; |
| + base::WeakPtrFactory<ToolbarButton> show_menu_factory_; |
| - DISALLOW_COPY_AND_ASSIGN(ButtonDropDown); |
| + DISALLOW_COPY_AND_ASSIGN(ToolbarButton); |
| }; |
| -} // namespace views |
| - |
| -#endif // UI_VIEWS_CONTROLS_BUTTON_BUTTON_DROPDOWN_H_ |
| +#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ |