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_client.h" | 10 #include "ui/aura/client/activation_client.h" |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 } | 766 } |
767 | 767 |
768 //////////////////////////////////////////////////////////////////////////////// | 768 //////////////////////////////////////////////////////////////////////////////// |
769 // NativeWidgetAura, aura::ActivationDelegate implementation: | 769 // NativeWidgetAura, aura::ActivationDelegate implementation: |
770 | 770 |
771 bool NativeWidgetAura::ShouldActivate(aura::Event* event) { | 771 bool NativeWidgetAura::ShouldActivate(aura::Event* event) { |
772 return can_activate_ && delegate_->CanActivate(); | 772 return can_activate_ && delegate_->CanActivate(); |
773 } | 773 } |
774 | 774 |
775 void NativeWidgetAura::OnActivated() { | 775 void NativeWidgetAura::OnActivated() { |
776 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 776 if (GetWidget()->HasFocusManager()) |
| 777 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
777 delegate_->OnNativeWidgetActivationChanged(true); | 778 delegate_->OnNativeWidgetActivationChanged(true); |
778 if (IsVisible() && GetWidget()->non_client_view()) | 779 if (IsVisible() && GetWidget()->non_client_view()) |
779 GetWidget()->non_client_view()->SchedulePaint(); | 780 GetWidget()->non_client_view()->SchedulePaint(); |
780 } | 781 } |
781 | 782 |
782 void NativeWidgetAura::OnLostActive() { | 783 void NativeWidgetAura::OnLostActive() { |
783 GetWidget()->GetFocusManager()->StoreFocusedView(); | 784 if (GetWidget()->HasFocusManager()) |
| 785 GetWidget()->GetFocusManager()->StoreFocusedView(); |
784 delegate_->OnNativeWidgetActivationChanged(false); | 786 delegate_->OnNativeWidgetActivationChanged(false); |
785 if (IsVisible() && GetWidget()->non_client_view()) | 787 if (IsVisible() && GetWidget()->non_client_view()) |
786 GetWidget()->non_client_view()->SchedulePaint(); | 788 GetWidget()->non_client_view()->SchedulePaint(); |
787 } | 789 } |
788 | 790 |
789 //////////////////////////////////////////////////////////////////////////////// | 791 //////////////////////////////////////////////////////////////////////////////// |
790 // NativeWidgetAura, aura::WindowDragDropDelegate implementation: | 792 // NativeWidgetAura, aura::WindowDragDropDelegate implementation: |
791 | 793 |
792 void NativeWidgetAura::OnDragEntered(const aura::DropTargetEvent& event) { | 794 void NativeWidgetAura::OnDragEntered(const aura::DropTargetEvent& event) { |
793 DCHECK(drop_helper_.get() != NULL); | 795 DCHECK(drop_helper_.get() != NULL); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 920 } |
919 } | 921 } |
920 | 922 |
921 // static | 923 // static |
922 bool NativeWidgetPrivate::IsMouseButtonDown() { | 924 bool NativeWidgetPrivate::IsMouseButtonDown() { |
923 return aura::Env::GetInstance()->is_mouse_button_down(); | 925 return aura::Env::GetInstance()->is_mouse_button_down(); |
924 } | 926 } |
925 | 927 |
926 } // namespace internal | 928 } // namespace internal |
927 } // namespace views | 929 } // namespace views |
OLD | NEW |