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

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 2524873002: Rename WindowTreeHost G|SetBounds to indicate they are in pixels. (Closed)
Patch Set: rebase Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This has to be before any other includes, else default is picked up. 5 // This has to be before any other includes, else default is picked up.
6 // See base/logging for details on this. 6 // See base/logging for details on this.
7 #define NOTIMPLEMENTED_POLICY 5 7 #define NOTIMPLEMENTED_POLICY 5
8 8
9 #include "ui/views/mus/native_widget_mus.h" 9 #include "ui/views/mus/native_widget_mus.h"
10 10
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 platform_window_delegate()->OnWindowStateChanged(state); 464 platform_window_delegate()->OnWindowStateChanged(state);
465 } 465 }
466 void OnWindowDestroyed(ui::Window* window) override { 466 void OnWindowDestroyed(ui::Window* window) override {
467 DCHECK_EQ(mus_window(), window); 467 DCHECK_EQ(mus_window(), window);
468 platform_window_delegate()->OnClosed(); 468 platform_window_delegate()->OnClosed();
469 } 469 }
470 void OnWindowBoundsChanging(ui::Window* window, 470 void OnWindowBoundsChanging(ui::Window* window,
471 const gfx::Rect& old_bounds, 471 const gfx::Rect& old_bounds,
472 const gfx::Rect& new_bounds) override { 472 const gfx::Rect& new_bounds) override {
473 DCHECK_EQ(window, mus_window()); 473 DCHECK_EQ(window, mus_window());
474 window_tree_host()->SetBounds(new_bounds); 474 window_tree_host()->SetBoundsInPixels(new_bounds);
475 } 475 }
476 void OnWindowFocusChanged(ui::Window* gained_focus, 476 void OnWindowFocusChanged(ui::Window* gained_focus,
477 ui::Window* lost_focus) override { 477 ui::Window* lost_focus) override {
478 if (gained_focus == mus_window()) 478 if (gained_focus == mus_window())
479 platform_window_delegate()->OnActivationChanged(true); 479 platform_window_delegate()->OnActivationChanged(true);
480 else if (lost_focus == mus_window()) 480 else if (lost_focus == mus_window())
481 platform_window_delegate()->OnActivationChanged(false); 481 platform_window_delegate()->OnActivationChanged(false);
482 } 482 }
483 void OnRequestClose(ui::Window* window) override { 483 void OnRequestClose(ui::Window* window) override {
484 platform_window_delegate()->OnCloseRequest(); 484 platform_window_delegate()->OnCloseRequest();
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 origin.Offset(-display_origin.x(), -display_origin.y()); 1020 origin.Offset(-display_origin.x(), -display_origin.y());
1021 1021
1022 gfx::Size size(bounds_in_screen.size()); 1022 gfx::Size size(bounds_in_screen.size());
1023 const gfx::Size min_size = GetMinimumSize(); 1023 const gfx::Size min_size = GetMinimumSize();
1024 const gfx::Size max_size = GetMaximumSize(); 1024 const gfx::Size max_size = GetMaximumSize();
1025 if (!max_size.IsEmpty()) 1025 if (!max_size.IsEmpty())
1026 size.SetToMin(max_size); 1026 size.SetToMin(max_size);
1027 size.SetToMax(min_size); 1027 size.SetToMax(min_size);
1028 window_->SetBounds(gfx::Rect(origin, size)); 1028 window_->SetBounds(gfx::Rect(origin, size));
1029 // Observer on |window_tree_host_| expected to synchronously update bounds. 1029 // Observer on |window_tree_host_| expected to synchronously update bounds.
1030 DCHECK(window_->bounds() == window_tree_host_->GetBounds()); 1030 DCHECK(window_->bounds() == window_tree_host_->GetBoundsInPixels());
1031 } 1031 }
1032 1032
1033 void NativeWidgetMus::SetSize(const gfx::Size& size) { 1033 void NativeWidgetMus::SetSize(const gfx::Size& size) {
1034 if (!window_tree_host_) 1034 if (!window_tree_host_)
1035 return; 1035 return;
1036 1036
1037 gfx::Rect bounds = window_tree_host_->GetBounds(); 1037 gfx::Rect bounds = window_tree_host_->GetBoundsInPixels();
1038 SetBounds(gfx::Rect(bounds.origin(), size)); 1038 SetBounds(gfx::Rect(bounds.origin(), size));
1039 } 1039 }
1040 1040
1041 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) { 1041 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) {
1042 NOTIMPLEMENTED(); 1042 NOTIMPLEMENTED();
1043 } 1043 }
1044 1044
1045 void NativeWidgetMus::StackAtTop() { 1045 void NativeWidgetMus::StackAtTop() {
1046 NOTIMPLEMENTED(); 1046 NOTIMPLEMENTED();
1047 } 1047 }
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 1575
1576 gfx::Path mask_path; 1576 gfx::Path mask_path;
1577 native_widget_delegate_->GetHitTestMask(&mask_path); 1577 native_widget_delegate_->GetHitTestMask(&mask_path);
1578 // TODO(jamescook): Use the full path for the mask. 1578 // TODO(jamescook): Use the full path for the mask.
1579 gfx::Rect mask_rect = 1579 gfx::Rect mask_rect =
1580 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1580 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1581 window_->SetHitTestMask(mask_rect); 1581 window_->SetHitTestMask(mask_rect);
1582 } 1582 }
1583 1583
1584 } // namespace views 1584 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | ui/views/mus/native_widget_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698