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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 10416017: Aura/ash split: Look for the ScreenPositionClient on the Window, not the RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/views/widget/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/activation_client.h" 10 #include "ui/aura/client/activation_client.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 const gfx::Rect* GetRestoreBounds(aura::Window* window) { 70 const gfx::Rect* GetRestoreBounds(aura::Window* window) {
71 return window->GetProperty(aura::client::kRestoreBoundsKey); 71 return window->GetProperty(aura::client::kRestoreBoundsKey);
72 } 72 }
73 73
74 void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) { 74 void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) {
75 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds)); 75 window->SetProperty(aura::client::kRestoreBoundsKey, new gfx::Rect(bounds));
76 } 76 }
77 77
78 void AdjustScreenBounds(aura::Window* window, gfx::Rect* bounds) {
79 aura::client::ScreenPositionClient* screen_position_client =
80 aura::client::GetScreenPositionClient(window);
81 if (screen_position_client) {
82 gfx::Point origin = bounds->origin();
83 screen_position_client->ConvertToScreenPoint(&origin);
84 bounds->set_origin(origin);
85 }
86 }
87
78 } // namespace 88 } // namespace
79 89
80 // Used when SetInactiveRenderingDisabled() is invoked to track when active 90 // Used when SetInactiveRenderingDisabled() is invoked to track when active
81 // status changes in such a way that we should enable inactive rendering. 91 // status changes in such a way that we should enable inactive rendering.
82 class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver { 92 class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver {
83 public: 93 public:
84 explicit ActiveWindowObserver(NativeWidgetAura* host) : host_(host) { 94 explicit ActiveWindowObserver(NativeWidgetAura* host) : host_(host) {
85 host_->GetNativeView()->GetRootWindow()->AddObserver(this); 95 host_->GetNativeView()->GetRootWindow()->AddObserver(this);
86 host_->GetNativeView()->AddObserver(this); 96 host_->GetNativeView()->AddObserver(this);
87 } 97 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 //NOTIMPLEMENTED(); 423 //NOTIMPLEMENTED();
414 } 424 }
415 425
416 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { 426 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) {
417 if (modal_type != ui::MODAL_TYPE_NONE) 427 if (modal_type != ui::MODAL_TYPE_NONE)
418 window_->SetProperty(aura::client::kModalKey, modal_type); 428 window_->SetProperty(aura::client::kModalKey, modal_type);
419 } 429 }
420 430
421 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { 431 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const {
422 gfx::Rect bounds = window_->GetBoundsInRootWindow(); 432 gfx::Rect bounds = window_->GetBoundsInRootWindow();
423 433 AdjustScreenBounds(window_, &bounds);
424 aura::client::ScreenPositionClient* screen_position_client =
425 aura::client::GetScreenPositionClient(window_->GetRootWindow());
426 if (screen_position_client) {
427 gfx::Point origin = bounds.origin();
428 screen_position_client->ConvertToScreenPoint(&origin);
429 bounds.set_origin(origin);
430 }
431
432 return bounds; 434 return bounds;
433 } 435 }
434 436
435 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { 437 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const {
436 // View-to-screen coordinate system transformations depend on this returning 438 // View-to-screen coordinate system transformations depend on this returning
437 // the full window bounds, for example View::ConvertPointToScreen(). 439 // the full window bounds, for example View::ConvertPointToScreen().
438 gfx::Rect bounds = window_->GetBoundsInRootWindow(); 440 gfx::Rect bounds = window_->GetBoundsInRootWindow();
439 441 AdjustScreenBounds(window_, &bounds);
440 aura::client::ScreenPositionClient* screen_position_client =
441 aura::client::GetScreenPositionClient(window_->GetRootWindow());
442 if (screen_position_client) {
443 gfx::Point origin = bounds.origin();
444 screen_position_client->ConvertToScreenPoint(&origin);
445 bounds.set_origin(origin);
446 }
447
448 return bounds; 442 return bounds;
449 } 443 }
450 444
451 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { 445 gfx::Rect NativeWidgetAura::GetRestoredBounds() const {
452 // Restored bounds should only be relevant if the window is minimized or 446 // Restored bounds should only be relevant if the window is minimized or
453 // maximized. However, in some places the code expectes GetRestoredBounds() 447 // maximized. However, in some places the code expectes GetRestoredBounds()
454 // to return the current window bounds if the window is not in either state. 448 // to return the current window bounds if the window is not in either state.
455 if (!IsMinimized() && !IsMaximized() && !IsFullscreen()) 449 if (!IsMinimized() && !IsMaximized() && !IsFullscreen())
456 return window_->bounds(); 450 return window_->bounds();
457 gfx::Rect* restore_bounds = 451 gfx::Rect* restore_bounds =
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 } 980 }
987 } 981 }
988 982
989 // static 983 // static
990 bool NativeWidgetPrivate::IsMouseButtonDown() { 984 bool NativeWidgetPrivate::IsMouseButtonDown() {
991 return aura::Env::GetInstance()->is_mouse_button_down(); 985 return aura::Env::GetInstance()->is_mouse_button_down();
992 } 986 }
993 987
994 } // namespace internal 988 } // namespace internal
995 } // namespace views 989 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698