| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { | 311 void* NativeWidgetAura::GetNativeWindowProperty(const char* name) const { |
| 312 return window_ ? window_->GetNativeWindowProperty(name) : NULL; | 312 return window_ ? window_->GetNativeWindowProperty(name) : NULL; |
| 313 } | 313 } |
| 314 | 314 |
| 315 TooltipManager* NativeWidgetAura::GetTooltipManager() const { | 315 TooltipManager* NativeWidgetAura::GetTooltipManager() const { |
| 316 return tooltip_manager_.get(); | 316 return tooltip_manager_.get(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool NativeWidgetAura::IsScreenReaderActive() const { | 319 bool NativeWidgetAura::IsScreenReaderActive() const { |
| 320 // http://crbug.com/102570 | 320 // http://crbug.com/102570 |
| 321 //NOTIMPLEMENTED(); | 321 // NOTIMPLEMENTED(); |
| 322 return false; | 322 return false; |
| 323 } | 323 } |
| 324 | 324 |
| 325 void NativeWidgetAura::SendNativeAccessibilityEvent( | 325 void NativeWidgetAura::SendNativeAccessibilityEvent( |
| 326 View* view, | 326 View* view, |
| 327 ui::AccessibilityTypes::Event event_type) { | 327 ui::AccessibilityTypes::Event event_type) { |
| 328 // http://crbug.com/102570 | 328 // http://crbug.com/102570 |
| 329 //NOTIMPLEMENTED(); | 329 // NOTIMPLEMENTED(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void NativeWidgetAura::SetCapture() { | 332 void NativeWidgetAura::SetCapture() { |
| 333 window_->SetCapture(); | 333 window_->SetCapture(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void NativeWidgetAura::ReleaseCapture() { | 336 void NativeWidgetAura::ReleaseCapture() { |
| 337 window_->ReleaseCapture(); | 337 window_->ReleaseCapture(); |
| 338 } | 338 } |
| 339 | 339 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 window_->set_title(title); | 396 window_->set_title(title); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, | 399 void NativeWidgetAura::SetWindowIcons(const gfx::ImageSkia& window_icon, |
| 400 const gfx::ImageSkia& app_icon) { | 400 const gfx::ImageSkia& app_icon) { |
| 401 // Aura doesn't have window icons. | 401 // Aura doesn't have window icons. |
| 402 } | 402 } |
| 403 | 403 |
| 404 void NativeWidgetAura::SetAccessibleName(const string16& name) { | 404 void NativeWidgetAura::SetAccessibleName(const string16& name) { |
| 405 // http://crbug.com/102570 | 405 // http://crbug.com/102570 |
| 406 //NOTIMPLEMENTED(); | 406 // NOTIMPLEMENTED(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { | 409 void NativeWidgetAura::SetAccessibleRole(ui::AccessibilityTypes::Role role) { |
| 410 // http://crbug.com/102570 | 410 // http://crbug.com/102570 |
| 411 //NOTIMPLEMENTED(); | 411 // NOTIMPLEMENTED(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { | 414 void NativeWidgetAura::SetAccessibleState(ui::AccessibilityTypes::State state) { |
| 415 // http://crbug.com/102570 | 415 // http://crbug.com/102570 |
| 416 //NOTIMPLEMENTED(); | 416 // NOTIMPLEMENTED(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { | 419 void NativeWidgetAura::InitModalType(ui::ModalType modal_type) { |
| 420 if (modal_type != ui::MODAL_TYPE_NONE) | 420 if (modal_type != ui::MODAL_TYPE_NONE) |
| 421 window_->SetProperty(aura::client::kModalKey, modal_type); | 421 window_->SetProperty(aura::client::kModalKey, modal_type); |
| 422 } | 422 } |
| 423 | 423 |
| 424 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { | 424 gfx::Rect NativeWidgetAura::GetWindowScreenBounds() const { |
| 425 gfx::Rect bounds = window_->GetBoundsInRootWindow(); | 425 gfx::Rect bounds = window_->GetBoundsInRootWindow(); |
| 426 AdjustScreenBounds(window_, &bounds); | 426 AdjustScreenBounds(window_, &bounds); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { | 603 void NativeWidgetAura::SetUseDragFrame(bool use_drag_frame) { |
| 604 NOTIMPLEMENTED(); | 604 NOTIMPLEMENTED(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 void NativeWidgetAura::FlashFrame(bool flash) { | 607 void NativeWidgetAura::FlashFrame(bool flash) { |
| 608 window_->SetProperty(aura::client::kDrawAttentionKey, flash); | 608 window_->SetProperty(aura::client::kDrawAttentionKey, flash); |
| 609 } | 609 } |
| 610 | 610 |
| 611 bool NativeWidgetAura::IsAccessibleWidget() const { | 611 bool NativeWidgetAura::IsAccessibleWidget() const { |
| 612 // http://crbug.com/102570 | 612 // http://crbug.com/102570 |
| 613 //NOTIMPLEMENTED(); | 613 // NOTIMPLEMENTED(); |
| 614 return false; | 614 return false; |
| 615 } | 615 } |
| 616 | 616 |
| 617 void NativeWidgetAura::RunShellDrag(View* view, | 617 void NativeWidgetAura::RunShellDrag(View* view, |
| 618 const ui::OSExchangeData& data, | 618 const ui::OSExchangeData& data, |
| 619 const gfx::Point& location, | 619 const gfx::Point& location, |
| 620 int operation) { | 620 int operation) { |
| 621 views::RunShellDrag(window_, data, location, operation); | 621 views::RunShellDrag(window_, data, location, operation); |
| 622 } | 622 } |
| 623 | 623 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 tooltip_manager_.reset(); | 802 tooltip_manager_.reset(); |
| 803 delegate_->OnNativeWidgetDestroyed(); | 803 delegate_->OnNativeWidgetDestroyed(); |
| 804 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 804 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 805 delete this; | 805 delete this; |
| 806 } | 806 } |
| 807 | 807 |
| 808 void NativeWidgetAura::OnWindowVisibilityChanged(bool visible) { | 808 void NativeWidgetAura::OnWindowVisibilityChanged(bool visible) { |
| 809 delegate_->OnNativeWidgetVisibilityChanged(visible); | 809 delegate_->OnNativeWidgetVisibilityChanged(visible); |
| 810 } | 810 } |
| 811 | 811 |
| 812 bool NativeWidgetAura::HasHitTestMask() const { |
| 813 return delegate_->HasHitTestMask(); |
| 814 } |
| 815 |
| 816 void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const { |
| 817 DCHECK(mask); |
| 818 delegate_->GetHitTestMask(mask); |
| 819 } |
| 820 |
| 812 //////////////////////////////////////////////////////////////////////////////// | 821 //////////////////////////////////////////////////////////////////////////////// |
| 813 // NativeWidgetAura, aura::ActivationDelegate implementation: | 822 // NativeWidgetAura, aura::ActivationDelegate implementation: |
| 814 | 823 |
| 815 bool NativeWidgetAura::ShouldActivate(const aura::Event* event) { | 824 bool NativeWidgetAura::ShouldActivate(const aura::Event* event) { |
| 816 return can_activate_ && delegate_->CanActivate(); | 825 return can_activate_ && delegate_->CanActivate(); |
| 817 } | 826 } |
| 818 | 827 |
| 819 void NativeWidgetAura::OnActivated() { | 828 void NativeWidgetAura::OnActivated() { |
| 820 if (GetWidget()->HasFocusManager()) | 829 if (GetWidget()->HasFocusManager()) |
| 821 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 830 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 return aura::Env::GetInstance()->is_mouse_button_down(); | 997 return aura::Env::GetInstance()->is_mouse_button_down(); |
| 989 } | 998 } |
| 990 | 999 |
| 991 // static | 1000 // static |
| 992 bool NativeWidgetPrivate::IsTouchDown() { | 1001 bool NativeWidgetPrivate::IsTouchDown() { |
| 993 return aura::Env::GetInstance()->is_touch_down(); | 1002 return aura::Env::GetInstance()->is_touch_down(); |
| 994 } | 1003 } |
| 995 | 1004 |
| 996 } // namespace internal | 1005 } // namespace internal |
| 997 } // namespace views | 1006 } // namespace views |
| OLD | NEW |