Commit 2c416928 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Quick Cleanup of ScreenCaptureNotificationUIViews

Quick cleanup for ScreenCaptureNotificationUIViews in preparation for
Layout changes in http://crbug.com/1005568.

BUG=
TBR=pkasting@chromium.org
Trivial changes.

Change-Id: Ic2934537d91e05467429e11976fba5b0ef96604c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825728
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699989}
parent a7df2380
...@@ -38,8 +38,6 @@ namespace { ...@@ -38,8 +38,6 @@ namespace {
const int kHorizontalMargin = 10; const int kHorizontalMargin = 10;
const float kWindowAlphaValue = 0.96f; const float kWindowAlphaValue = 0.96f;
namespace {
// A ClientView that overrides NonClientHitTest() so that the whole window area // A ClientView that overrides NonClientHitTest() so that the whole window area
// acts as a window caption, except a rect specified using set_client_rect(). // acts as a window caption, except a rect specified using set_client_rect().
// ScreenCaptureNotificationUIViews uses this class to make the notification bar // ScreenCaptureNotificationUIViews uses this class to make the notification bar
...@@ -53,7 +51,7 @@ class NotificationBarClientView : public views::ClientView { ...@@ -53,7 +51,7 @@ class NotificationBarClientView : public views::ClientView {
void set_client_rect(const gfx::Rect& rect) { rect_ = rect; } void set_client_rect(const gfx::Rect& rect) { rect_ = rect; }
// views::ClientView overrides. // views::ClientView:
int NonClientHitTest(const gfx::Point& point) override { int NonClientHitTest(const gfx::Point& point) override {
if (!bounds().Contains(point)) if (!bounds().Contains(point))
return HTNOWHERE; return HTNOWHERE;
...@@ -70,8 +68,6 @@ class NotificationBarClientView : public views::ClientView { ...@@ -70,8 +68,6 @@ class NotificationBarClientView : public views::ClientView {
DISALLOW_COPY_AND_ASSIGN(NotificationBarClientView); DISALLOW_COPY_AND_ASSIGN(NotificationBarClientView);
}; };
} // namespace
// ScreenCaptureNotificationUI implementation using Views. // ScreenCaptureNotificationUI implementation using Views.
class ScreenCaptureNotificationUIViews class ScreenCaptureNotificationUIViews
: public ScreenCaptureNotificationUI, : public ScreenCaptureNotificationUI,
...@@ -82,15 +78,15 @@ class ScreenCaptureNotificationUIViews ...@@ -82,15 +78,15 @@ class ScreenCaptureNotificationUIViews
explicit ScreenCaptureNotificationUIViews(const base::string16& text); explicit ScreenCaptureNotificationUIViews(const base::string16& text);
~ScreenCaptureNotificationUIViews() override; ~ScreenCaptureNotificationUIViews() override;
// ScreenCaptureNotificationUI interface. // ScreenCaptureNotificationUI:
gfx::NativeViewId OnStarted( gfx::NativeViewId OnStarted(
base::OnceClosure stop_callback, base::OnceClosure stop_callback,
content::MediaStreamUI::SourceCallback source_callback) override; content::MediaStreamUI::SourceCallback source_callback) override;
// views::View overrides. // views::View:
void Layout() override; void Layout() override;
// views::WidgetDelegateView overrides. // views::WidgetDelegateView:
void DeleteDelegate() override; void DeleteDelegate() override;
views::ClientView* CreateClientView(views::Widget* widget) override; views::ClientView* CreateClientView(views::Widget* widget) override;
views::NonClientFrameView* CreateNonClientFrameView( views::NonClientFrameView* CreateNonClientFrameView(
...@@ -100,10 +96,10 @@ class ScreenCaptureNotificationUIViews ...@@ -100,10 +96,10 @@ class ScreenCaptureNotificationUIViews
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
bool CanActivate() const override; bool CanActivate() const override;
// views::ButtonListener interface. // views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override; void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::LinkListener interface. // views::LinkListener:
void LinkClicked(views::Link* source, int event_flags) override; void LinkClicked(views::Link* source, int event_flags) override;
private: private:
...@@ -112,28 +108,22 @@ class ScreenCaptureNotificationUIViews ...@@ -112,28 +108,22 @@ class ScreenCaptureNotificationUIViews
// Helper to call |source_callback_|. // Helper to call |source_callback_|.
void NotifySourceChange(); void NotifySourceChange();
const base::string16 text_;
base::OnceClosure stop_callback_; base::OnceClosure stop_callback_;
content::MediaStreamUI::SourceCallback source_callback_; content::MediaStreamUI::SourceCallback source_callback_;
NotificationBarClientView* client_view_; NotificationBarClientView* client_view_ = nullptr;
views::ImageView* gripper_; views::ImageView* gripper_ = nullptr;
views::Label* label_; views::Label* label_ = nullptr;
views::Button* source_button_; views::Button* source_button_ = nullptr;
views::Button* stop_button_; views::Button* stop_button_ = nullptr;
views::Link* hide_link_; views::Link* hide_link_ = nullptr;
const base::string16 text_;
DISALLOW_COPY_AND_ASSIGN(ScreenCaptureNotificationUIViews); DISALLOW_COPY_AND_ASSIGN(ScreenCaptureNotificationUIViews);
}; };
ScreenCaptureNotificationUIViews::ScreenCaptureNotificationUIViews( ScreenCaptureNotificationUIViews::ScreenCaptureNotificationUIViews(
const base::string16& text) const base::string16& text)
: text_(text), : text_(text) {
client_view_(nullptr),
gripper_(nullptr),
label_(nullptr),
source_button_(nullptr),
stop_button_(nullptr),
hide_link_(nullptr) {
set_owned_by_client(); set_owned_by_client();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment