Commit 30fdb0bd authored by Jennifer Apacible's avatar Jennifer Apacible Committed by Commit Bot

Fix ordering of functions in OverlayWindowViews.

Overridden functions from views::Widget were not in order. No behavioral
changes.

Change-Id: Iedf7df7a0b04827e4de5b98c8197ded36dd67510
Reviewed-on: https://chromium-review.googlesource.com/1197743
Commit-Queue: apacible <apacible@chromium.org>
Reviewed-by: default avatarCJ DiMeglio <lethalantidote@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588079}
parent c74500c2
......@@ -579,6 +579,20 @@ gfx::Rect OverlayWindowViews::GetSecondCustomControlsBounds() {
return second_custom_controls_view_->GetMirroredBounds();
}
void OverlayWindowViews::OnNativeBlur() {
// Controls should be hidden when there is no more focus on the window. This
// is used for tabbing and touch interactions. For mouse interactions, the
// window cannot be blurred before the ui::ET_MOUSE_EXITED event is handled.
if (is_initialized_)
UpdateControlsVisibility(false);
views::Widget::OnNativeBlur();
}
void OverlayWindowViews::OnNativeWidgetDestroyed() {
controller_->OnWindowDestroyed();
}
gfx::Size OverlayWindowViews::GetMinimumSize() const {
return min_size_;
}
......@@ -587,6 +601,33 @@ gfx::Size OverlayWindowViews::GetMaximumSize() const {
return max_size_;
}
void OverlayWindowViews::OnNativeWidgetMove() {
// Hide the controls when the window is moving. The controls will reappear
// when the user interacts with the window again.
if (is_initialized_)
UpdateControlsVisibility(false);
// Update the existing |window_bounds_| when the window moves. This allows
// the window to reappear with the same origin point when a new video is
// shown.
window_bounds_ = GetBounds();
}
void OverlayWindowViews::OnNativeWidgetSizeChanged(const gfx::Size& new_size) {
// Hide the controls when the window is being resized. The controls will
// reappear when the user interacts with the window again.
if (is_initialized_)
UpdateControlsVisibility(false);
// Update the view layers to scale to |new_size|.
UpdateCustomControlsSize(first_custom_controls_view_.get());
UpdateCustomControlsSize(second_custom_controls_view_.get());
UpdatePlayPauseControlsSize();
UpdateLayerBoundsWithLetterboxing(new_size);
views::Widget::OnNativeWidgetSizeChanged(new_size);
}
void OverlayWindowViews::OnNativeWidgetWorkspaceChanged() {
// TODO(apacible): Update sizes and maybe resize the current
// Picture-in-Picture window. Currently, switching between workspaces on linux
......@@ -705,47 +746,6 @@ void OverlayWindowViews::ButtonPressed(views::Button* sender,
controller_->ClickCustomControl(second_custom_controls_view_->id());
}
void OverlayWindowViews::OnNativeBlur() {
// Controls should be hidden when there is no more focus on the window. This
// is used for tabbing and touch interactions. For mouse interactions, the
// window cannot be blurred before the ui::ET_MOUSE_EXITED event is handled.
if (is_initialized_)
UpdateControlsVisibility(false);
views::Widget::OnNativeBlur();
}
void OverlayWindowViews::OnNativeWidgetMove() {
// Hide the controls when the window is moving. The controls will reappear
// when the user interacts with the window again.
if (is_initialized_)
UpdateControlsVisibility(false);
// Update the existing |window_bounds_| when the window moves. This allows
// the window to reappear with the same origin point when a new video is
// shown.
window_bounds_ = GetBounds();
}
void OverlayWindowViews::OnNativeWidgetSizeChanged(const gfx::Size& new_size) {
// Hide the controls when the window is being resized. The controls will
// reappear when the user interacts with the window again.
if (is_initialized_)
UpdateControlsVisibility(false);
// Update the view layers to scale to |new_size|.
UpdateCustomControlsSize(first_custom_controls_view_.get());
UpdateCustomControlsSize(second_custom_controls_view_.get());
UpdatePlayPauseControlsSize();
UpdateLayerBoundsWithLetterboxing(new_size);
views::Widget::OnNativeWidgetSizeChanged(new_size);
}
void OverlayWindowViews::OnNativeWidgetDestroyed() {
controller_->OnWindowDestroyed();
}
void OverlayWindowViews::TogglePlayPause() {
// Retrieve expected active state based on what command was sent in
// TogglePlayPause() since the IPC message may not have been propogated
......
......@@ -45,8 +45,12 @@ class OverlayWindowViews : public content::OverlayWindow,
gfx::Rect GetVideoBounds() override;
// views::Widget:
void OnNativeBlur() override;
void OnNativeWidgetDestroyed() override;
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
void OnNativeWidgetMove() override;
void OnNativeWidgetSizeChanged(const gfx::Size& new_size) override;
void OnNativeWidgetWorkspaceChanged() override;
void OnKeyEvent(ui::KeyEvent* event) override;
void OnMouseEvent(ui::MouseEvent* event) override;
......@@ -55,12 +59,6 @@ class OverlayWindowViews : public content::OverlayWindow,
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::internal::NativeWidgetDelegate:
void OnNativeBlur() override;
void OnNativeWidgetMove() override;
void OnNativeWidgetSizeChanged(const gfx::Size& new_size) override;
void OnNativeWidgetDestroyed() override;
// Gets the bounds of the controls.
gfx::Rect GetCloseControlsBounds();
gfx::Rect GetPlayPauseControlsBounds();
......
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