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

Unified Diff: ui/views/mus/native_widget_mus.cc

Issue 2009853002: Finish eliminating PlatformWindowMus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: From wth->SetBounds to observer on OnWindowBoundsChanging Created 4 years, 7 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: ui/views/mus/native_widget_mus.cc
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index ff20192c20c969df0e8f63de2372f72dc0ca8f55..8cf60f7192eb697aca0ebe7cf8df66dd682e1d65 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -28,10 +28,10 @@
#include "ui/base/hit_test.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/path.h"
#include "ui/native_theme/native_theme_aura.h"
#include "ui/platform_window/platform_window_delegate.h"
-#include "ui/views/mus/platform_window_mus.h"
#include "ui/views/mus/surface_context_factory.h"
#include "ui/views/mus/window_manager_constants_converters.h"
#include "ui/views/mus/window_manager_frame_values.h"
@@ -413,6 +413,12 @@ class NativeWidgetMus::MusWindowObserver : public mus::WindowObserver {
DCHECK_EQ(mus_window(), window);
platform_window_delegate()->OnClosed();
}
+ void OnWindowBoundsChanging(mus::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) override {
+ DCHECK_EQ(window, mus_window());
+ window_tree_host()->SetBounds(new_bounds);
+ }
void OnWindowFocusChanged(mus::Window* gained_focus,
mus::Window* lost_focus) override {
if (gained_focus == mus_window())
@@ -639,6 +645,7 @@ NonClientFrameView* NativeWidgetMus::CreateNonClientFrameView() {
void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
NativeWidgetAura::RegisterNativeWidgetForWindow(this, content_);
+ aura::Window* hosted_window = window_tree_host_->window();
ownership_ = params.ownership;
window_->SetCanFocus(params.activatable ==
@@ -646,17 +653,16 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
window_tree_host_->AddObserver(this);
window_tree_host_->InitHost();
- window_tree_host_->window()->SetProperty(kMusWindow, window_);
+ hosted_window->SetProperty(kMusWindow, window_);
focus_client_.reset(
- new wm::FocusController(new FocusRulesImpl(window_tree_host_->window())));
+ new wm::FocusController(new FocusRulesImpl(hosted_window)));
- aura::client::SetFocusClient(window_tree_host_->window(),
- focus_client_.get());
- aura::client::SetActivationClient(window_tree_host_->window(),
+ aura::client::SetFocusClient(hosted_window, focus_client_.get());
+ aura::client::SetActivationClient(hosted_window,
focus_client_.get());
screen_position_client_.reset(new ScreenPositionClientMus(window_));
- aura::client::SetScreenPositionClient(window_tree_host_->window(),
+ aura::client::SetScreenPositionClient(hosted_window,
screen_position_client_.get());
// TODO(erg): Remove this check when mash/wm/frame/move_event_handler.cc's
@@ -665,17 +671,17 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
if (surface_type_ == mus::mojom::SurfaceType::DEFAULT) {
cursor_manager_.reset(new wm::CursorManager(
base::WrapUnique(new NativeCursorManagerMus(window_))));
- aura::client::SetCursorClient(window_tree_host_->window(),
+ aura::client::SetCursorClient(hosted_window,
cursor_manager_.get());
}
window_tree_client_.reset(
- new NativeWidgetMusWindowTreeClient(window_tree_host_->window()));
- window_tree_host_->window()->AddPreTargetHandler(focus_client_.get());
- window_tree_host_->window()->SetLayoutManager(
- new ContentWindowLayoutManager(window_tree_host_->window(), content_));
+ new NativeWidgetMusWindowTreeClient(hosted_window));
+ hosted_window->AddPreTargetHandler(focus_client_.get());
+ hosted_window->SetLayoutManager(
+ new ContentWindowLayoutManager(hosted_window, content_));
capture_client_.reset(
- new MusCaptureClient(window_tree_host_->window(), content_, window_));
+ new MusCaptureClient(hosted_window, content_, window_));
content_->SetType(ui::wm::WINDOW_TYPE_NORMAL);
content_->Init(ui::LAYER_TEXTURED);
@@ -683,7 +689,7 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
content_->Show();
content_->SetTransparent(true);
content_->SetFillsBoundsCompletely(false);
- window_tree_host_->window()->AddChild(content_);
+ hosted_window->AddChild(content_);
// Set-up transiency if appropriate.
if (params.parent && !params.child) {
@@ -890,7 +896,6 @@ void NativeWidgetMus::SetBounds(const gfx::Rect& bounds) {
if (!max_size.IsEmpty())
size.SetToMin(max_size);
size.SetToMax(min_size);
- window_tree_host_->SetBounds(gfx::Rect(bounds.origin(), size));
sadrul 2016/05/26 01:31:01 Would it make sense to keep this here, but to over
Mark Dittmer 2016/05/26 13:37:33 I have to admit I don't understand the suggestion.
window_->SetBounds(gfx::Rect(bounds.origin(), size));
}
@@ -1030,11 +1035,11 @@ void NativeWidgetMus::Restore() {
}
void NativeWidgetMus::SetFullscreen(bool fullscreen) {
- if (!window_tree_host_ || IsFullscreen() == fullscreen)
+ if (IsFullscreen() == fullscreen)
return;
if (fullscreen) {
show_state_before_fullscreen_ = mus_window_observer_->show_state();
- window_tree_host_->platform_window()->ToggleFullscreen();
+ // TODO(markdittmer): Fullscreen not implemented in mus::Window.
} else {
switch (show_state_before_fullscreen_) {
case mus::mojom::ShowState::MAXIMIZED:

Powered by Google App Engine
This is Rietveld 408576698