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

Unified Diff: chrome/browser/ui/views/toolbar/button_dropdown.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 | « chrome/browser/ui/views/toolbar/back_button.cc ('k') | chrome/browser/ui/views/toolbar/button_dropdown.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/button_dropdown.h
diff --git a/chrome/browser/ui/views/toolbar/button_dropdown.h b/chrome/browser/ui/views/toolbar/button_dropdown.h
deleted file mode 100644
index e3e0b0e02041dc60f8cbd93dfb22d77a526ed6c4..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/views/toolbar/button_dropdown.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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_BUTTON_DROPDOWN_H_
-#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BUTTON_DROPDOWN_H_
-
-#include "base/memory/weak_ptr.h"
-#include "ui/views/context_menu_controller.h"
-#include "ui/views/controls/button/image_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 ButtonDropDown : public views::ImageButton,
- public views::ContextMenuController {
- public:
- // The button's class name.
- static const char kViewClassName[];
-
- // Takes ownership of the |model|.
- ButtonDropDown(views::ButtonListener* listener, ui::MenuModel* model);
- virtual ~ButtonDropDown();
-
- // If menu is currently pending for long press - stop it.
- void ClearPendingMenu();
-
- // Indicates if menu is currently showing.
- 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;
- virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
- virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
-
- // Overridden from views::ContextMenuController
- virtual void ShowContextMenuForView(views::View* source,
- const gfx::Point& point,
- ui::MenuSourceType source_type) OVERRIDE;
-
- protected:
- // Overridden from CustomButton. Returns true if the button should become
- // pressed when a user holds the mouse down over the button. For this
- // implementation, both left and right mouse buttons can trigger a change
- // to the PUSHED state.
- virtual bool ShouldEnterPushedState(const ui::Event& event) OVERRIDE;
-
- // Returns if menu should be shown. Override this to change default behavior.
- virtual bool ShouldShowMenu();
-
- // Function to show the dropdown menu.
- virtual void ShowDropDownMenu(ui::MenuSourceType source_type);
-
- private:
- // The model that populates the attached menu.
- scoped_ptr<ui::MenuModel> model_;
-
- // Indicates if menu is currently showing.
- bool menu_showing_;
-
- // Y position of mouse when left mouse button is pressed
- int y_position_on_lbuttondown_;
-
- // Menu runner to display drop down menu.
- 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_;
-
- DISALLOW_COPY_AND_ASSIGN(ButtonDropDown);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BUTTON_DROPDOWN_H_
« no previous file with comments | « chrome/browser/ui/views/toolbar/back_button.cc ('k') | chrome/browser/ui/views/toolbar/button_dropdown.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698