| 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { | 575 void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { |
| 576 cursor_ = cursor; | 576 cursor_ = cursor; |
| 577 aura::client::CursorClient* cursor_client = | 577 aura::client::CursorClient* cursor_client = |
| 578 aura::client::GetCursorClient(window_->GetRootWindow()); | 578 aura::client::GetCursorClient(window_->GetRootWindow()); |
| 579 if (cursor_client) | 579 if (cursor_client) |
| 580 cursor_client->SetCursor(cursor); | 580 cursor_client->SetCursor(cursor); |
| 581 } | 581 } |
| 582 | 582 |
| 583 void NativeWidgetAura::ClearNativeFocus() { | 583 void NativeWidgetAura::ClearNativeFocus() { |
| 584 if (window_ && window_->GetFocusManager() && | 584 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
| 585 window_->Contains(window_->GetFocusManager()->GetFocusedWindow())) | 585 if (window_ && client && window_->Contains(client->GetFocusedWindow())) |
| 586 window_->GetFocusManager()->SetFocusedWindow(window_, NULL); | 586 client->FocusWindow(window_, NULL); |
| 587 } | 587 } |
| 588 | 588 |
| 589 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { | 589 gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { |
| 590 return gfx::Screen::GetScreenFor(GetNativeView())-> | 590 return gfx::Screen::GetScreenFor(GetNativeView())-> |
| 591 GetDisplayNearestWindow(GetNativeView()).work_area(); | 591 GetDisplayNearestWindow(GetNativeView()).work_area(); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { | 594 void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { |
| 595 if (!value) { | 595 if (!value) { |
| 596 active_window_observer_.reset(); | 596 active_window_observer_.reset(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 // gone, and creating a new one and telling it that we lost the focus will | 673 // gone, and creating a new one and telling it that we lost the focus will |
| 674 // trigger a DCHECK (the new input method doesn't think that we have the focus | 674 // trigger a DCHECK (the new input method doesn't think that we have the focus |
| 675 // and doesn't expect a blur). OnBlur() shouldn't be called during | 675 // and doesn't expect a blur). OnBlur() shouldn't be called during |
| 676 // destruction unless WIDGET_OWNS_NATIVE_WIDGET is set (which is just the case | 676 // destruction unless WIDGET_OWNS_NATIVE_WIDGET is set (which is just the case |
| 677 // in tests). | 677 // in tests). |
| 678 if (!destroying_) | 678 if (!destroying_) |
| 679 GetWidget()->GetInputMethod()->OnBlur(); | 679 GetWidget()->GetInputMethod()->OnBlur(); |
| 680 else | 680 else |
| 681 DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); | 681 DCHECK_EQ(ownership_, Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); |
| 682 | 682 |
| 683 delegate_->OnNativeBlur(window_->GetFocusManager()->GetFocusedWindow()); | 683 delegate_->OnNativeBlur( |
| 684 aura::client::GetFocusClient(window_)->GetFocusedWindow()); |
| 684 } | 685 } |
| 685 | 686 |
| 686 gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { | 687 gfx::NativeCursor NativeWidgetAura::GetCursor(const gfx::Point& point) { |
| 687 return cursor_; | 688 return cursor_; |
| 688 } | 689 } |
| 689 | 690 |
| 690 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { | 691 int NativeWidgetAura::GetNonClientComponent(const gfx::Point& point) const { |
| 691 return delegate_->GetNonClientComponent(point); | 692 return delegate_->GetNonClientComponent(point); |
| 692 } | 693 } |
| 693 | 694 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 return aura::Env::GetInstance()->is_mouse_button_down(); | 1041 return aura::Env::GetInstance()->is_mouse_button_down(); |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 // static | 1044 // static |
| 1044 bool NativeWidgetPrivate::IsTouchDown() { | 1045 bool NativeWidgetPrivate::IsTouchDown() { |
| 1045 return aura::Env::GetInstance()->is_touch_down(); | 1046 return aura::Env::GetInstance()->is_touch_down(); |
| 1046 } | 1047 } |
| 1047 | 1048 |
| 1048 } // namespace internal | 1049 } // namespace internal |
| 1049 } // namespace views | 1050 } // namespace views |
| OLD | NEW |