| 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/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_change_observer.h" | 10 #include "ui/aura/client/activation_change_observer.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 gfx::Point origin = bounds->origin(); | 84 gfx::Point origin = bounds->origin(); |
| 85 screen_position_client->ConvertToScreenPoint(&origin); | 85 screen_position_client->ConvertToScreenPoint(&origin); |
| 86 bounds->set_origin(origin); | 86 bounds->set_origin(origin); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace | 90 } // namespace |
| 91 | 91 |
| 92 // Used when SetInactiveRenderingDisabled() is invoked to track when active | 92 // Used when SetInactiveRenderingDisabled() is invoked to track when active |
| 93 // status changes in such a way that we should enable inactive rendering. | 93 // status changes in such a way that we should enable inactive rendering. |
| 94 class NativeWidgetAura::ActiveWindowObserver : | 94 class NativeWidgetAura::ActiveWindowObserver |
| 95 public aura::WindowObserver, | 95 : public aura::WindowObserver, |
| 96 public aura::client::ActivationChangeObserver { | 96 public aura::client::ActivationChangeObserver { |
| 97 public: | 97 public: |
| 98 explicit ActiveWindowObserver(NativeWidgetAura* host) : host_(host) { | 98 explicit ActiveWindowObserver(NativeWidgetAura* host) : host_(host) { |
| 99 host_->GetNativeView()->GetRootWindow()->AddObserver(this); | 99 host_->GetNativeView()->GetRootWindow()->AddObserver(this); |
| 100 host_->GetNativeView()->AddObserver(this); | 100 host_->GetNativeView()->AddObserver(this); |
| 101 aura::client::GetActivationClient(host_->GetNativeView()->GetRootWindow())-> | 101 aura::client::GetActivationClient(host_->GetNativeView()->GetRootWindow())-> |
| 102 AddObserver(this); | 102 AddObserver(this); |
| 103 } | 103 } |
| 104 virtual ~ActiveWindowObserver() { | 104 virtual ~ActiveWindowObserver() { |
| 105 CleanUpObservers(); | 105 CleanUpObservers(); |
| 106 } | 106 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { | 318 void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { |
| 319 return window_ ? window_->GetNativeWindowProperty(name) : NULL; | 319 return window_ ? window_->GetNativeWindowProperty(name) : NULL; |
| 320 } | 320 } |
| 321 | 321 |
| 322 TooltipManager* NativeWidgetAura::GetTooltipManager() const { | 322 TooltipManager* NativeWidgetAura::GetTooltipManager() const { |
| 323 return tooltip_manager_.get(); | 323 return tooltip_manager_.get(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool NativeWidgetAura::IsScreenReaderActive() const { | 326 bool NativeWidgetAura::IsScreenReaderActive() const { |
| 327 // http://crbug.com/102570 | 327 // http://crbug.com/102570 |
| 328 //NOTIMPLEMENTED(); | 328 // NOTIMPLEMENTED(); |
| 329 return false; | 329 return false; |
| 330 } | 330 } |
| 331 | 331 |
| 332 void NativeWidgetAura::SendNativeAccessibilityEvent( | 332 void NativeWidgetAura::SendNativeAccessibilityEvent( |
| 333 View* view, | 333 View* view, |
| 334 ui::AccessibilityTypes::Event event_type) { | 334 ui::AccessibilityTypes::Event event_type) { |
| 335 // http://crbug.com/102570 | 335 // http://crbug.com/102570 |
| 336 //NOTIMPLEMENTED(); | 336 // NOTIMPLEMENTED(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void NativeWidgetAura::SetCapture() { | 339 void NativeWidgetAura::SetCapture() { |
| 340 window_->SetCapture(); | 340 window_->SetCapture(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void NativeWidgetAura::ReleaseCapture() { | 343 void NativeWidgetAura::ReleaseCapture() { |
| 344 window_->ReleaseCapture(); | 344 window_->ReleaseCapture(); |
| 345 } | 345 } |
| 346 | 346 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 window_->set_title(title); | 403 window_->set_title(title); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, | 406 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, |
| 407 const gfx::ImageSkia& app_icon) { | 407 const gfx::ImageSkia& app_icon) { |
| 408 // Aura doesn't have window icons. | 408 // Aura doesn't have window icons. |
| 409 } | 409 } |
| 410 | 410 |
| 411 void NativeWidgetAura::SetAccessibleName(const string16& name) { | 411 void NativeWidgetAura::SetAccessibleName(const string16& name) { |
| 412 // http://crbug.com/102570 | 412 // http://crbug.com/102570 |
| 413 //NOTIMPLEMENTED(); | 413 // NOTIMPLEMENTED(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { | 416 void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { |
| 417 // http://crbug.com/102570 | 417 // http://crbug.com/102570 |
| 418 //NOTIMPLEMENTED(); | 418 // NOTIMPLEMENTED(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { | 421 void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { |
| 422 // http://crbug.com/102570 | 422 // http://crbug.com/102570 |
| 423 //NOTIMPLEMENTED(); | 423 // NOTIMPLEMENTED(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { | 426 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { |
| 427 if (modal_type != ui::MODAL_TYPE_NONE) | 427 if (modal_type != ui::MODAL_TYPE_NONE) |
| 428 window_->SetProperty(aura::client::kModalKey, modal_type); | 428 window_->SetProperty(aura::client::kModalKey, modal_type); |
| 429 } | 429 } |
| 430 | 430 |
| 431 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { | 431 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { |
| 432 gfx::Rect bounds = window_->GetBoundsInRootWindow(); | 432 gfx::Rect bounds = window_->GetBoundsInRootWindow(); |
| 433 AdjustScreenBounds(window_, &bounds); | 433 AdjustScreenBounds(window_, &bounds); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { | 610 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { |
| 611 NOTIMPLEMENTED(); | 611 NOTIMPLEMENTED(); |
| 612 } | 612 } |
| 613 | 613 |
| 614 void NativeWidgetAura::FlashFrame(bool flash) { | 614 void NativeWidgetAura::FlashFrame(bool flash) { |
| 615 window_->SetProperty(aura::client::kDrawAttentionKey, flash); | 615 window_->SetProperty(aura::client::kDrawAttentionKey, flash); |
| 616 } | 616 } |
| 617 | 617 |
| 618 bool NativeWidgetAura::IsAccessibleWidget() const { | 618 bool NativeWidgetAura::IsAccessibleWidget() const { |
| 619 // http://crbug.com/102570 | 619 // http://crbug.com/102570 |
| 620 //NOTIMPLEMENTED(); | 620 // NOTIMPLEMENTED(); |
| 621 return false; | 621 return false; |
| 622 } | 622 } |
| 623 | 623 |
| 624 void NativeWidgetAura::RunShellDrag(View* view, | 624 void NativeWidgetAura::RunShellDrag(View* view, |
| 625 const ui::OSExchangeData& data, | 625 const ui::OSExchangeData& data, |
| 626 const gfx::Point& location, | 626 const gfx::Point& location, |
| 627 int operation) { | 627 int operation) { |
| 628 views::RunShellDrag(window_, data, location, operation); | 628 views::RunShellDrag(window_, data, location, operation); |
| 629 } | 629 } |
| 630 | 630 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 tooltip_manager_.reset(); | 809 tooltip_manager_.reset(); |
| 810 delegate_->OnNativeWidgetDestroyed(); | 810 delegate_->OnNativeWidgetDestroyed(); |
| 811 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 811 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 812 delete this; | 812 delete this; |
| 813 } | 813 } |
| 814 | 814 |
| 815 void NativeWidgetAura::OnWindowVisibilityChanged(bool visible) { | 815 void NativeWidgetAura::OnWindowVisibilityChanged(bool visible) { |
| 816 delegate_->OnNativeWidgetVisibilityChanged(visible); | 816 delegate_->OnNativeWidgetVisibilityChanged(visible); |
| 817 } | 817 } |
| 818 | 818 |
| 819 bool NativeWidgetAura::HasHitTestMask() const { |
| 820 return delegate_->HasHitTestMask(); |
| 821 } |
| 822 |
| 823 void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const { |
| 824 DCHECK(mask); |
| 825 delegate_->GetHitTestMask(mask); |
| 826 } |
| 827 |
| 819 //////////////////////////////////////////////////////////////////////////////// | 828 //////////////////////////////////////////////////////////////////////////////// |
| 820 // NativeWidgetAura, aura::ActivationDelegate implementation: | 829 // NativeWidgetAura, aura::ActivationDelegate implementation: |
| 821 | 830 |
| 822 bool NativeWidgetAura::ShouldActivate(const aura::Event* event) { | 831 bool NativeWidgetAura::ShouldActivate(const aura::Event* event) { |
| 823 return can_activate_ && delegate_->CanActivate(); | 832 return can_activate_ && delegate_->CanActivate(); |
| 824 } | 833 } |
| 825 | 834 |
| 826 void NativeWidgetAura::OnActivated() { | 835 void NativeWidgetAura::OnActivated() { |
| 827 if (GetWidget()->HasFocusManager()) | 836 if (GetWidget()->HasFocusManager()) |
| 828 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 837 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 return aura::Env::GetInstance()->is_mouse_button_down(); | 994 return aura::Env::GetInstance()->is_mouse_button_down(); |
| 986 } | 995 } |
| 987 | 996 |
| 988 // static | 997 // static |
| 989 bool NativeWidgetPrivate::IsTouchDown() { | 998 bool NativeWidgetPrivate::IsTouchDown() { |
| 990 return aura::Env::GetInstance()->is_touch_down(); | 999 return aura::Env::GetInstance()->is_touch_down(); |
| 991 } | 1000 } |
| 992 | 1001 |
| 993 } // namespace internal | 1002 } // namespace internal |
| 994 } // namespace views | 1003 } // namespace views |
| OLD | NEW |