OLD | NEW |
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/strings/string_util.h" | 8 #include "base/strings/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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 window_->ReleaseCapture(); | 269 window_->ReleaseCapture(); |
270 } | 270 } |
271 | 271 |
272 bool NativeWidgetAura::HasCapture() const { | 272 bool NativeWidgetAura::HasCapture() const { |
273 return window_ && window_->HasCapture(); | 273 return window_ && window_->HasCapture(); |
274 } | 274 } |
275 | 275 |
276 InputMethod* NativeWidgetAura::CreateInputMethod() { | 276 InputMethod* NativeWidgetAura::CreateInputMethod() { |
277 if (!window_) | 277 if (!window_) |
278 return NULL; | 278 return NULL; |
279 aura::RootWindow* root_window = window_->GetRootWindow(); | 279 aura::Window* root_window = window_->GetRootWindow(); |
280 ui::InputMethod* host = | 280 ui::InputMethod* host = |
281 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); | 281 root_window->GetProperty(aura::client::kRootWindowInputMethodKey); |
282 return new InputMethodBridge(this, host, true); | 282 return new InputMethodBridge(this, host, true); |
283 } | 283 } |
284 | 284 |
285 internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() { | 285 internal::InputMethodDelegate* NativeWidgetAura::GetInputMethodDelegate() { |
286 return this; | 286 return this; |
287 } | 287 } |
288 | 288 |
289 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { | 289 void NativeWidgetAura::CenterWindow(const gfx::Size& size) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (restore_bounds) | 384 if (restore_bounds) |
385 return *restore_bounds; | 385 return *restore_bounds; |
386 } | 386 } |
387 return window_->GetBoundsInScreen(); | 387 return window_->GetBoundsInScreen(); |
388 } | 388 } |
389 | 389 |
390 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { | 390 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { |
391 if (!window_) | 391 if (!window_) |
392 return; | 392 return; |
393 | 393 |
394 aura::RootWindow* root = window_->GetRootWindow(); | 394 aura::Window* root = window_->GetRootWindow(); |
395 if (root) { | 395 if (root) { |
396 aura::client::ScreenPositionClient* screen_position_client = | 396 aura::client::ScreenPositionClient* screen_position_client = |
397 aura::client::GetScreenPositionClient(root); | 397 aura::client::GetScreenPositionClient(root); |
398 if (screen_position_client) { | 398 if (screen_position_client) { |
399 gfx::Display dst_display = | 399 gfx::Display dst_display = |
400 gfx::Screen::GetScreenFor(window_)->GetDisplayMatching(bounds); | 400 gfx::Screen::GetScreenFor(window_)->GetDisplayMatching(bounds); |
401 screen_position_client->SetBounds(window_, bounds, dst_display); | 401 screen_position_client->SetBounds(window_, bounds, dst_display); |
402 return; | 402 return; |
403 } | 403 } |
404 } | 404 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( | 516 aura::client::GetActivationClient(window_->GetRootWindow())->DeactivateWindow( |
517 window_); | 517 window_); |
518 } | 518 } |
519 | 519 |
520 bool NativeWidgetAura::IsActive() const { | 520 bool NativeWidgetAura::IsActive() const { |
521 if (!window_) | 521 if (!window_) |
522 return false; | 522 return false; |
523 | 523 |
524 // We may up here during destruction of the root, in which case | 524 // We may up here during destruction of the root, in which case |
525 // GetRootWindow() returns NULL (~RootWindow() has run and we're in ~Window). | 525 // GetRootWindow() returns NULL (~RootWindow() has run and we're in ~Window). |
526 aura::RootWindow* root = window_->GetRootWindow(); | 526 aura::Window* root = window_->GetRootWindow(); |
527 return root && | 527 return root && |
528 aura::client::GetActivationClient(root)->GetActiveWindow() == window_; | 528 aura::client::GetActivationClient(root)->GetActiveWindow() == window_; |
529 } | 529 } |
530 | 530 |
531 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { | 531 void NativeWidgetAura::SetAlwaysOnTop(bool on_top) { |
532 if (window_) | 532 if (window_) |
533 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); | 533 window_->SetProperty(aura::client::kAlwaysOnTopKey, on_top); |
534 } | 534 } |
535 | 535 |
536 bool NativeWidgetAura::IsAlwaysOnTop() const { | 536 bool NativeWidgetAura::IsAlwaysOnTop() const { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 // always done. (The previous behaviour of aura::Window::SetParent() used | 1111 // always done. (The previous behaviour of aura::Window::SetParent() used |
1112 // NULL as a special value that meant ask the WindowTreeClient where things | 1112 // NULL as a special value that meant ask the WindowTreeClient where things |
1113 // should go.) | 1113 // should go.) |
1114 // | 1114 // |
1115 // This probably isn't strictly correct, but its an invariant that a Window | 1115 // This probably isn't strictly correct, but its an invariant that a Window |
1116 // in use will be attached to a RootWindow, so we can't just call | 1116 // in use will be attached to a RootWindow, so we can't just call |
1117 // RemoveChild here. The only possible thing that could assign a RootWindow | 1117 // RemoveChild here. The only possible thing that could assign a RootWindow |
1118 // in this case is the stacking client of the current RootWindow. This | 1118 // in this case is the stacking client of the current RootWindow. This |
1119 // matches our previous behaviour; the global stacking client would almost | 1119 // matches our previous behaviour; the global stacking client would almost |
1120 // always reattach the window to the same RootWindow. | 1120 // always reattach the window to the same RootWindow. |
1121 aura::RootWindow* root_window = native_view->GetRootWindow(); | 1121 aura::Window* root_window = native_view->GetRootWindow(); |
1122 aura::client::ParentWindowWithContext( | 1122 aura::client::ParentWindowWithContext( |
1123 native_view, root_window, root_window->GetBoundsInScreen()); | 1123 native_view, root_window, root_window->GetBoundsInScreen()); |
1124 } | 1124 } |
1125 | 1125 |
1126 // And now, notify them that they have a brand new parent. | 1126 // And now, notify them that they have a brand new parent. |
1127 for (Widget::Widgets::iterator it = widgets.begin(); | 1127 for (Widget::Widgets::iterator it = widgets.begin(); |
1128 it != widgets.end(); ++it) { | 1128 it != widgets.end(); ++it) { |
1129 (*it)->NotifyNativeViewHierarchyChanged(); | 1129 (*it)->NotifyNativeViewHierarchyChanged(); |
1130 } | 1130 } |
1131 } | 1131 } |
1132 | 1132 |
1133 // static | 1133 // static |
1134 bool NativeWidgetPrivate::IsMouseButtonDown() { | 1134 bool NativeWidgetPrivate::IsMouseButtonDown() { |
1135 return aura::Env::GetInstance()->IsMouseButtonDown(); | 1135 return aura::Env::GetInstance()->IsMouseButtonDown(); |
1136 } | 1136 } |
1137 | 1137 |
1138 // static | 1138 // static |
1139 bool NativeWidgetPrivate::IsTouchDown() { | 1139 bool NativeWidgetPrivate::IsTouchDown() { |
1140 return aura::Env::GetInstance()->is_touch_down(); | 1140 return aura::Env::GetInstance()->is_touch_down(); |
1141 } | 1141 } |
1142 | 1142 |
1143 } // namespace internal | 1143 } // namespace internal |
1144 } // namespace views | 1144 } // namespace views |
OLD | NEW |