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

Side by Side Diff: chrome/browser/ui/views/tabs/media_indicator_button.h

Issue 1354823002: Render the tab close button as a vector-based icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/tabs/tab_utils.h" 9 #include "chrome/browser/ui/tabs/tab_utils.h"
10 #include "ui/views/controls/button/image_button.h" 10 #include "ui/views/controls/button/image_button.h"
(...skipping 22 matching lines...) Expand all
33 33
34 explicit MediaIndicatorButton(Tab* parent_tab); 34 explicit MediaIndicatorButton(Tab* parent_tab);
35 ~MediaIndicatorButton() override; 35 ~MediaIndicatorButton() override;
36 36
37 // Returns the current TabMediaState except, while the indicator image is 37 // Returns the current TabMediaState except, while the indicator image is
38 // fading out, returns the prior TabMediaState. 38 // fading out, returns the prior TabMediaState.
39 TabMediaState showing_media_state() const { 39 TabMediaState showing_media_state() const {
40 return showing_media_state_; 40 return showing_media_state_;
41 } 41 }
42 42
43 // Updates ImageButton images, starts fade animations, and 43 // Calls ResetImages(), starts fade animations, and activates/deactivates
44 // activates/deactivates button functionality as appropriate. 44 // button functionality as appropriate.
45 void TransitionToMediaState(TabMediaState next_state); 45 void TransitionToMediaState(TabMediaState next_state);
46 46
47 // Determines whether the MediaIndicatorButton will be clickable for toggling 47 // Determines whether the MediaIndicatorButton will be clickable for toggling
48 // muting. This should be called whenever the active/inactive state of a tab 48 // muting. This should be called whenever the active/inactive state of a tab
49 // has changed. Internally, TransitionToMediaState() and OnBoundsChanged() 49 // has changed. Internally, TransitionToMediaState() and OnBoundsChanged()
50 // calls this when the TabMediaState or the bounds have changed. 50 // calls this when the TabMediaState or the bounds have changed.
51 void UpdateEnabledForMuteToggle(); 51 void UpdateEnabledForMuteToggle();
52 52
53 // Called when the parent tab's button color changes. Determines whether
54 // ResetImages() needs to be called.
55 void OnParentTabButtonColorChanged();
56
53 protected: 57 protected:
54 // views::View: 58 // views::View:
55 const char* GetClassName() const override; 59 const char* GetClassName() const override;
56 View* GetTooltipHandlerForPoint(const gfx::Point& point) override; 60 View* GetTooltipHandlerForPoint(const gfx::Point& point) override;
57 bool OnMousePressed(const ui::MouseEvent& event) override; 61 bool OnMousePressed(const ui::MouseEvent& event) override;
58 bool OnMouseDragged(const ui::MouseEvent& event) override; 62 bool OnMouseDragged(const ui::MouseEvent& event) override;
59 void OnMouseEntered(const ui::MouseEvent& event) override; 63 void OnMouseEntered(const ui::MouseEvent& event) override;
60 void OnMouseMoved(const ui::MouseEvent& event) override; 64 void OnMouseMoved(const ui::MouseEvent& event) override;
61 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 65 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
62 void OnPaint(gfx::Canvas* canvas) override; 66 void OnPaint(gfx::Canvas* canvas) override;
63 67
64 // views::ViewTargeterDelegate 68 // views::ViewTargeterDelegate
65 bool DoesIntersectRect(const View* target, 69 bool DoesIntersectRect(const View* target,
66 const gfx::Rect& rect) const override; 70 const gfx::Rect& rect) const override;
67 71
68 // views::Button: 72 // views::Button:
69 void NotifyClick(const ui::Event& event) override; 73 void NotifyClick(const ui::Event& event) override;
70 74
71 // views::CustomButton: 75 // views::CustomButton:
72 bool IsTriggerableEvent(const ui::Event& event) override; 76 bool IsTriggerableEvent(const ui::Event& event) override;
73 77
74 private: 78 private:
75 class FadeAnimationDelegate; 79 class FadeAnimationDelegate;
76 80
77 // Returns the tab (parent view) of this MediaIndicatorButton. 81 // Returns the tab (parent view) of this MediaIndicatorButton.
78 Tab* GetTab() const; 82 Tab* GetTab() const;
79 83
84 // Resets the images to display on the button to reflect |state| and the
85 // parent tab's button color. Should be called when either of these changes.
86 void ResetImages(TabMediaState state);
87
80 Tab* const parent_tab_; 88 Tab* const parent_tab_;
81 89
82 TabMediaState media_state_; 90 TabMediaState media_state_;
83 91
84 // Media indicator fade-in/out animation (i.e., only on show/hide, not a 92 // Media indicator fade-in/out animation (i.e., only on show/hide, not a
85 // continuous animation). 93 // continuous animation).
86 scoped_ptr<gfx::AnimationDelegate> fade_animation_delegate_; 94 scoped_ptr<gfx::AnimationDelegate> fade_animation_delegate_;
87 scoped_ptr<gfx::Animation> fade_animation_; 95 scoped_ptr<gfx::Animation> fade_animation_;
88 TabMediaState showing_media_state_; 96 TabMediaState showing_media_state_;
89 97
90 DISALLOW_COPY_AND_ASSIGN(MediaIndicatorButton); 98 DISALLOW_COPY_AND_ASSIGN(MediaIndicatorButton);
91 }; 99 };
92 100
93 #endif // CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_ 101 #endif // CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/layout_constants.cc ('k') | chrome/browser/ui/views/tabs/media_indicator_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698