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/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 event_client_.reset(new DesktopEventClient); | 525 event_client_.reset(new DesktopEventClient); |
526 aura::client::SetEventClient(host_->window(), event_client_.get()); | 526 aura::client::SetEventClient(host_->window(), event_client_.get()); |
527 | 527 |
528 aura::client::GetFocusClient(content_window_)->FocusWindow(content_window_); | 528 aura::client::GetFocusClient(content_window_)->FocusWindow(content_window_); |
529 | 529 |
530 aura::client::SetActivationDelegate(content_window_, this); | 530 aura::client::SetActivationDelegate(content_window_, this); |
531 | 531 |
532 shadow_controller_.reset(new wm::ShadowController( | 532 shadow_controller_.reset(new wm::ShadowController( |
533 aura::client::GetActivationClient(host_->window()))); | 533 aura::client::GetActivationClient(host_->window()))); |
534 | 534 |
535 content_window_->SetProperty(aura::client::kCanMaximizeKey, | 535 OnSizeConstraintsChanged(); |
536 GetWidget()->widget_delegate()->CanMaximize()); | |
537 content_window_->SetProperty(aura::client::kCanResizeKey, | |
538 GetWidget()->widget_delegate()->CanResize()); | |
539 | 536 |
540 window_reorderer_.reset(new WindowReorderer(content_window_, | 537 window_reorderer_.reset(new WindowReorderer(content_window_, |
541 GetWidget()->GetRootView())); | 538 GetWidget()->GetRootView())); |
542 } | 539 } |
543 | 540 |
544 NonClientFrameView* DesktopNativeWidgetAura::CreateNonClientFrameView() { | 541 NonClientFrameView* DesktopNativeWidgetAura::CreateNonClientFrameView() { |
545 return ShouldUseNativeFrame() ? new NativeFrameView(GetWidget()) : NULL; | 542 return ShouldUseNativeFrame() ? new NativeFrameView(GetWidget()) : NULL; |
546 } | 543 } |
547 | 544 |
548 bool DesktopNativeWidgetAura::ShouldUseNativeFrame() const { | 545 bool DesktopNativeWidgetAura::ShouldUseNativeFrame() const { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 void DesktopNativeWidgetAura::OnRootViewLayout() { | 926 void DesktopNativeWidgetAura::OnRootViewLayout() { |
930 if (content_window_) | 927 if (content_window_) |
931 desktop_window_tree_host_->OnRootViewLayout(); | 928 desktop_window_tree_host_->OnRootViewLayout(); |
932 } | 929 } |
933 | 930 |
934 bool DesktopNativeWidgetAura::IsTranslucentWindowOpacitySupported() const { | 931 bool DesktopNativeWidgetAura::IsTranslucentWindowOpacitySupported() const { |
935 return content_window_ && | 932 return content_window_ && |
936 desktop_window_tree_host_->IsTranslucentWindowOpacitySupported(); | 933 desktop_window_tree_host_->IsTranslucentWindowOpacitySupported(); |
937 } | 934 } |
938 | 935 |
| 936 void DesktopNativeWidgetAura::OnSizeConstraintsChanged() { |
| 937 content_window_->SetProperty(aura::client::kCanMaximizeKey, |
| 938 GetWidget()->widget_delegate()->CanMaximize()); |
| 939 content_window_->SetProperty(aura::client::kCanResizeKey, |
| 940 GetWidget()->widget_delegate()->CanResize()); |
| 941 } |
| 942 |
939 void DesktopNativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) { | 943 void DesktopNativeWidgetAura::RepostNativeEvent(gfx::NativeEvent native_event) { |
940 OnEvent(native_event); | 944 OnEvent(native_event); |
941 } | 945 } |
942 | 946 |
943 //////////////////////////////////////////////////////////////////////////////// | 947 //////////////////////////////////////////////////////////////////////////////// |
944 // DesktopNativeWidgetAura, aura::WindowDelegate implementation: | 948 // DesktopNativeWidgetAura, aura::WindowDelegate implementation: |
945 | 949 |
946 gfx::Size DesktopNativeWidgetAura::GetMinimumSize() const { | 950 gfx::Size DesktopNativeWidgetAura::GetMinimumSize() const { |
947 return native_widget_delegate_->GetMinimumSize(); | 951 return native_widget_delegate_->GetMinimumSize(); |
948 } | 952 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 if (cursor_reference_count_ == 0) { | 1208 if (cursor_reference_count_ == 0) { |
1205 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1209 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
1206 // for cleaning up |cursor_manager_|. | 1210 // for cleaning up |cursor_manager_|. |
1207 delete cursor_manager_; | 1211 delete cursor_manager_; |
1208 native_cursor_manager_ = NULL; | 1212 native_cursor_manager_ = NULL; |
1209 cursor_manager_ = NULL; | 1213 cursor_manager_ = NULL; |
1210 } | 1214 } |
1211 } | 1215 } |
1212 | 1216 |
1213 } // namespace views | 1217 } // namespace views |
OLD | NEW |