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

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: Created 4 years, 1 month 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 platform_window_delegate()->OnWindowStateChanged(state); 463 platform_window_delegate()->OnWindowStateChanged(state);
464 } 464 }
465 void OnWindowDestroyed(ui::Window* window) override { 465 void OnWindowDestroyed(ui::Window* window) override {
466 DCHECK_EQ(mus_window(), window); 466 DCHECK_EQ(mus_window(), window);
467 platform_window_delegate()->OnClosed(); 467 platform_window_delegate()->OnClosed();
468 } 468 }
469 void OnWindowBoundsChanging(ui::Window* window, 469 void OnWindowBoundsChanging(ui::Window* window,
470 const gfx::Rect& old_bounds, 470 const gfx::Rect& old_bounds,
471 const gfx::Rect& new_bounds) override { 471 const gfx::Rect& new_bounds) override {
472 DCHECK_EQ(window, mus_window()); 472 DCHECK_EQ(window, mus_window());
473 window_tree_host()->SetBounds(new_bounds); 473 window_tree_host()->SetBoundsInPixel(new_bounds);
474 } 474 }
475 void OnWindowFocusChanged(ui::Window* gained_focus, 475 void OnWindowFocusChanged(ui::Window* gained_focus,
476 ui::Window* lost_focus) override { 476 ui::Window* lost_focus) override {
477 if (gained_focus == mus_window()) 477 if (gained_focus == mus_window())
478 platform_window_delegate()->OnActivationChanged(true); 478 platform_window_delegate()->OnActivationChanged(true);
479 else if (lost_focus == mus_window()) 479 else if (lost_focus == mus_window())
480 platform_window_delegate()->OnActivationChanged(false); 480 platform_window_delegate()->OnActivationChanged(false);
481 } 481 }
482 void OnRequestClose(ui::Window* window) override { 482 void OnRequestClose(ui::Window* window) override {
483 platform_window_delegate()->OnCloseRequest(); 483 platform_window_delegate()->OnCloseRequest();
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 origin.Offset(-display_origin.x(), -display_origin.y()); 1015 origin.Offset(-display_origin.x(), -display_origin.y());
1016 1016
1017 gfx::Size size(bounds_in_screen.size()); 1017 gfx::Size size(bounds_in_screen.size());
1018 const gfx::Size min_size = GetMinimumSize(); 1018 const gfx::Size min_size = GetMinimumSize();
1019 const gfx::Size max_size = GetMaximumSize(); 1019 const gfx::Size max_size = GetMaximumSize();
1020 if (!max_size.IsEmpty()) 1020 if (!max_size.IsEmpty())
1021 size.SetToMin(max_size); 1021 size.SetToMin(max_size);
1022 size.SetToMax(min_size); 1022 size.SetToMax(min_size);
1023 window_->SetBounds(gfx::Rect(origin, size)); 1023 window_->SetBounds(gfx::Rect(origin, size));
1024 // Observer on |window_tree_host_| expected to synchronously update bounds. 1024 // Observer on |window_tree_host_| expected to synchronously update bounds.
1025 DCHECK(window_->bounds() == window_tree_host_->GetBounds()); 1025 DCHECK(window_->bounds() == window_tree_host_->GetBoundsInPixel());
1026 } 1026 }
1027 1027
1028 void NativeWidgetMus::SetSize(const gfx::Size& size) { 1028 void NativeWidgetMus::SetSize(const gfx::Size& size) {
1029 if (!window_tree_host_) 1029 if (!window_tree_host_)
1030 return; 1030 return;
1031 1031
1032 gfx::Rect bounds = window_tree_host_->GetBounds(); 1032 gfx::Rect bounds = window_tree_host_->GetBoundsInPixel();
1033 SetBounds(gfx::Rect(bounds.origin(), size)); 1033 SetBounds(gfx::Rect(bounds.origin(), size));
1034 } 1034 }
1035 1035
1036 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) { 1036 void NativeWidgetMus::StackAbove(gfx::NativeView native_view) {
1037 NOTIMPLEMENTED(); 1037 NOTIMPLEMENTED();
1038 } 1038 }
1039 1039
1040 void NativeWidgetMus::StackAtTop() { 1040 void NativeWidgetMus::StackAtTop() {
1041 NOTIMPLEMENTED(); 1041 NOTIMPLEMENTED();
1042 } 1042 }
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 1570
1571 gfx::Path mask_path; 1571 gfx::Path mask_path;
1572 native_widget_delegate_->GetHitTestMask(&mask_path); 1572 native_widget_delegate_->GetHitTestMask(&mask_path);
1573 // TODO(jamescook): Use the full path for the mask. 1573 // TODO(jamescook): Use the full path for the mask.
1574 gfx::Rect mask_rect = 1574 gfx::Rect mask_rect =
1575 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1575 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1576 window_->SetHitTestMask(mask_rect); 1576 window_->SetHitTestMask(mask_rect);
1577 } 1577 }
1578 1578
1579 } // namespace views 1579 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698