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

Unified Diff: chrome/browser/ui/views/tabs/media_indicator_button.h

Issue 1827083004: UI: Rename MediaState to AlertState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-tab-indicator
Patch Set: Keep gypi ordered 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: chrome/browser/ui/views/tabs/media_indicator_button.h
diff --git a/chrome/browser/ui/views/tabs/media_indicator_button.h b/chrome/browser/ui/views/tabs/media_indicator_button.h
deleted file mode 100644
index 82f5a0c0f36fb8f5ccd1aab4358318c98ce50b5b..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/views/tabs/media_indicator_button.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 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_TABS_MEDIA_INDICATOR_BUTTON_H_
-#define CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_
-
-#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/ui/tabs/tab_utils.h"
-#include "ui/views/controls/button/image_button.h"
-#include "ui/views/view_targeter_delegate.h"
-
-class Tab;
-
-namespace gfx {
-class Animation;
-class AnimationDelegate;
-}
-
-// This is an ImageButton subclass that serves as both the media indicator icon
-// (audio, tab capture, etc.), and as a mute button. It is meant to only be
-// used as a child view of Tab.
-//
-// When the indicator is transitioned to the audio playing or muting state, the
-// button functionality is enabled and begins handling mouse events. Otherwise,
-// this view behaves like an image and all mouse events will be handled by the
-// Tab (its parent View).
-class MediaIndicatorButton : public views::ImageButton,
- public views::ViewTargeterDelegate {
- public:
- // The MediaIndicatorButton's class name.
- static const char kViewClassName[];
-
- explicit MediaIndicatorButton(Tab* parent_tab);
- ~MediaIndicatorButton() override;
-
- // Returns the current TabMediaState except, while the indicator image is
- // fading out, returns the prior TabMediaState.
- TabMediaState showing_media_state() const {
- return showing_media_state_;
- }
-
- // Calls ResetImages(), starts fade animations, and activates/deactivates
- // button functionality as appropriate.
- void TransitionToMediaState(TabMediaState next_state);
-
- // Determines whether the MediaIndicatorButton will be clickable for toggling
- // muting. This should be called whenever the active/inactive state of a tab
- // has changed. Internally, TransitionToMediaState() and OnBoundsChanged()
- // calls this when the TabMediaState or the bounds have changed.
- void UpdateEnabledForMuteToggle();
-
- // Called when the parent tab's button color changes. Determines whether
- // ResetImages() needs to be called.
- void OnParentTabButtonColorChanged();
-
- protected:
- // views::View:
- const char* GetClassName() const override;
- View* GetTooltipHandlerForPoint(const gfx::Point& point) override;
- bool OnMousePressed(const ui::MouseEvent& event) override;
- bool OnMouseDragged(const ui::MouseEvent& event) override;
- void OnMouseEntered(const ui::MouseEvent& event) override;
- void OnMouseMoved(const ui::MouseEvent& event) override;
- void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
- void OnPaint(gfx::Canvas* canvas) override;
-
- // views::ViewTargeterDelegate
- bool DoesIntersectRect(const View* target,
- const gfx::Rect& rect) const override;
-
- // views::Button:
- void NotifyClick(const ui::Event& event) override;
-
- // views::CustomButton:
- bool IsTriggerableEvent(const ui::Event& event) override;
-
- private:
- friend class MediaIndicatorButtonTest;
- class FadeAnimationDelegate;
-
- // Returns the tab (parent view) of this MediaIndicatorButton.
- Tab* GetTab() const;
-
- // Resets the images to display on the button to reflect |state| and the
- // parent tab's button color. Should be called when either of these changes.
- void ResetImages(TabMediaState state);
-
- Tab* const parent_tab_;
-
- TabMediaState media_state_;
-
- // Media indicator fade-in/out animation (i.e., only on show/hide, not a
- // continuous animation).
- scoped_ptr<gfx::AnimationDelegate> fade_animation_delegate_;
- scoped_ptr<gfx::Animation> fade_animation_;
- TabMediaState showing_media_state_;
-
- DISALLOW_COPY_AND_ASSIGN(MediaIndicatorButton);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_TABS_MEDIA_INDICATOR_BUTTON_H_
« no previous file with comments | « chrome/browser/ui/views/tabs/browser_tab_strip_controller.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