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

Unified Diff: ash/shelf/shelf_button.h

Issue 1816753002: Enable mash shelf tooltips. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revise tooltip event testing. Created 4 years, 9 months 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
Index: ash/shelf/shelf_button.h
diff --git a/ash/shelf/shelf_button.h b/ash/shelf/shelf_button.h
index 4e63e9e31db7104b87292f3d57e884ac7227595c..4a84a61a532d502bb5d7a60e0047ef4beea274a6 100644
--- a/ash/shelf/shelf_button.h
+++ b/ash/shelf/shelf_button.h
@@ -12,8 +12,7 @@
#include "ui/views/controls/image_view.h"
namespace ash {
-class Shelf;
-class ShelfButtonHost;
+class ShelfView;
// Button used for items on the launcher, except for the AppList.
class ASH_EXPORT ShelfButton : public views::CustomButton {
@@ -38,13 +37,9 @@ class ASH_EXPORT ShelfButton : public views::CustomButton {
STATE_HIDDEN = 1 << 5,
};
+ explicit ShelfButton(ShelfView* shelf_view);
~ShelfButton() override;
- // Called to create an instance of a ShelfButton.
- static ShelfButton* Create(views::ButtonListener* listener,
- ShelfButtonHost* host,
- Shelf* shelf);
-
// Sets the image to display for this entry.
void SetImage(const gfx::ImageSkia& image);
@@ -55,7 +50,6 @@ class ASH_EXPORT ShelfButton : public views::CustomButton {
void AddState(State state);
void ClearState(State state);
int state() const { return state_; }
- const Shelf* shelf() const { return shelf_; }
// Returns the bounds of the icon.
gfx::Rect GetIconBounds() const;
@@ -68,37 +62,11 @@ class ASH_EXPORT ShelfButton : public views::CustomButton {
void OnMouseCaptureLost() override;
protected:
- ShelfButton(views::ButtonListener* listener,
- ShelfButtonHost* host,
- Shelf* shelf);
-
- // Class that draws the icon part of a button, so it can be animated
- // independently of the rest. This can be subclassed to provide a custom
- // implementation, by overriding CreateIconView().
- class IconView : public views::ImageView {
- public:
- IconView();
- ~IconView() override;
-
- void set_icon_size(int icon_size) { icon_size_ = icon_size; }
- int icon_size() const { return icon_size_; }
-
- private:
- // Set to non-zero to force icons to be resized to fit within a square,
- // while maintaining original proportions.
- int icon_size_;
-
- DISALLOW_COPY_AND_ASSIGN(IconView);
- };
-
// View overrides:
const char* GetClassName() const override;
bool OnMousePressed(const ui::MouseEvent& event) override;
void OnMouseReleased(const ui::MouseEvent& event) override;
bool OnMouseDragged(const ui::MouseEvent& event) override;
- void OnMouseMoved(const ui::MouseEvent& event) override;
- void OnMouseEntered(const ui::MouseEvent& event) override;
- void OnMouseExited(const ui::MouseEvent& event) override;
void GetAccessibleState(ui::AXViewState* state) override;
void Layout() override;
void ChildPreferredSizeChanged(views::View* child) override;
@@ -111,12 +79,6 @@ class ASH_EXPORT ShelfButton : public views::CustomButton {
// Sets the icon image with a shadow.
void SetShadowedImage(const gfx::ImageSkia& bitmap);
- // Override for custom initialization.
- virtual void Init();
- // Override to subclass IconView.
- virtual IconView* CreateIconView();
- IconView* icon_view() const { return icon_view_; }
- ShelfButtonHost* host() const { return host_; }
private:
class BarView;
@@ -128,15 +90,17 @@ class ASH_EXPORT ShelfButton : public views::CustomButton {
// Updates the status bar (bitmap, orientation, visibility).
void UpdateBar();
- ShelfButtonHost* host_;
- IconView* icon_view_;
+ // The shelf view hosting this button.
+ ShelfView* shelf_view_;
+
+ // The icon part of a button can be animated independently of the rest.
+ views::ImageView* icon_view_;
+
// Draws a bar underneath the image to represent the state of the application.
BarView* bar_;
- // The current state of the application, multiple values of AppState are or'd
- // together.
- int state_;
- Shelf* shelf_;
+ // The current application state, a bitfield of State enum values.
+ int state_;
gfx::ShadowValues icon_shadows_;

Powered by Google App Engine
This is Rietveld 408576698