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

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

Issue 10409011: Aura/ash: On Desktops, use a aura::client to resolve screen coordinates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge with trunk. 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
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"
11 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
12 #include "ui/aura/client/drag_drop_client.h" 12 #include "ui/aura/client/drag_drop_client.h"
13 #include "ui/aura/client/screen_position_client.h"
13 #include "ui/aura/client/window_move_client.h" 14 #include "ui/aura/client/window_move_client.h"
14 #include "ui/aura/client/window_types.h" 15 #include "ui/aura/client/window_types.h"
15 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
16 #include "ui/aura/event.h" 17 #include "ui/aura/event.h"
17 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
18 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
19 #include "ui/aura/window_observer.h" 20 #include "ui/aura/window_observer.h"
20 #include "ui/base/dragdrop/os_exchange_data.h" 21 #include "ui/base/dragdrop/os_exchange_data.h"
21 #include "ui/base/ui_base_types.h" 22 #include "ui/base/ui_base_types.h"
22 #include "ui/compositor/layer.h" 23 #include "ui/compositor/layer.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 #endif 163 #endif
163 } 164 }
164 165
165 //////////////////////////////////////////////////////////////////////////////// 166 ////////////////////////////////////////////////////////////////////////////////
166 // NativeWidgetAura, internal::NativeWidgetPrivate implementation: 167 // NativeWidgetAura, internal::NativeWidgetPrivate implementation:
167 168
168 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { 169 void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
169 ownership_ = params.ownership; 170 ownership_ = params.ownership;
170 171
171 if (desktop_helper_.get()) 172 if (desktop_helper_.get())
172 desktop_helper_->PreInitialize(params); 173 desktop_helper_->PreInitialize(window_, params);
173 174
174 window_->set_user_data(this); 175 window_->set_user_data(this);
175 window_->SetType(GetAuraWindowTypeForWidgetType(params.type)); 176 window_->SetType(GetAuraWindowTypeForWidgetType(params.type));
176 window_->SetProperty(aura::client::kShowStateKey, params.show_state); 177 window_->SetProperty(aura::client::kShowStateKey, params.show_state);
177 if (params.type == Widget::InitParams::TYPE_BUBBLE) 178 if (params.type == Widget::InitParams::TYPE_BUBBLE)
178 aura::client::SetHideOnDeactivate(window_, true); 179 aura::client::SetHideOnDeactivate(window_, true);
179 window_->SetTransparent(params.transparent); 180 window_->SetTransparent(params.transparent);
180 window_->Init(params.layer_type); 181 window_->Init(params.layer_type);
181 if (params.type == Widget::InitParams::TYPE_CONTROL) 182 if (params.type == Widget::InitParams::TYPE_CONTROL)
182 window_->Show(); 183 window_->Show();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 //NOTIMPLEMENTED(); 413 //NOTIMPLEMENTED();
413 } 414 }
414 415
415 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { 416 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) {
416 if (modal_type != ui::MODAL_TYPE_NONE) 417 if (modal_type != ui::MODAL_TYPE_NONE)
417 window_->SetProperty(aura::client::kModalKey, modal_type); 418 window_->SetProperty(aura::client::kModalKey, modal_type);
418 } 419 }
419 420
420 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { 421 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const {
421 gfx::Rect bounds = window_->GetBoundsInRootWindow(); 422 gfx::Rect bounds = window_->GetBoundsInRootWindow();
422 if (desktop_helper_.get()) 423
423 bounds = desktop_helper_->ChangeRootWindowBoundsToScreenBounds(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
424 return bounds; 432 return bounds;
425 } 433 }
426 434
427 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const { 435 gfx::Rect NativeWidgetAura::GetClientAreaScreenBounds() const {
428 // View-to-screen coordinate system transformations depend on this returning 436 // View-to-screen coordinate system transformations depend on this returning
429 // the full window bounds, for example View::ConvertPointToScreen(). 437 // the full window bounds, for example View::ConvertPointToScreen().
430 gfx::Rect bounds = window_->GetBoundsInRootWindow(); 438 gfx::Rect bounds = window_->GetBoundsInRootWindow();
431 if (desktop_helper_.get()) 439
432 bounds = desktop_helper_->ChangeRootWindowBoundsToScreenBounds(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
433 return bounds; 448 return bounds;
434 } 449 }
435 450
436 gfx::Rect NativeWidgetAura::GetRestoredBounds() const { 451 gfx::Rect NativeWidgetAura::GetRestoredBounds() const {
437 // Restored bounds should only be relevant if the window is minimized or 452 // Restored bounds should only be relevant if the window is minimized or
438 // maximized. However, in some places the code expectes GetRestoredBounds() 453 // maximized. However, in some places the code expectes GetRestoredBounds()
439 // to return the current window bounds if the window is not in either state. 454 // to return the current window bounds if the window is not in either state.
440 if (!IsMinimized() && !IsMaximized() && !IsFullscreen()) 455 if (!IsMinimized() && !IsMaximized() && !IsFullscreen())
441 return window_->bounds(); 456 return window_->bounds();
442 gfx::Rect* restore_bounds = 457 gfx::Rect* restore_bounds =
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 986 }
972 } 987 }
973 988
974 // static 989 // static
975 bool NativeWidgetPrivate::IsMouseButtonDown() { 990 bool NativeWidgetPrivate::IsMouseButtonDown() {
976 return aura::Env::GetInstance()->is_mouse_button_down(); 991 return aura::Env::GetInstance()->is_mouse_button_down();
977 } 992 }
978 993
979 } // namespace internal 994 } // namespace internal
980 } // namespace views 995 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_native_widget_helper_aura.cc ('k') | ui/views/widget/native_widget_helper_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698