| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ui/compositor/layer.h" | 24 #include "ui/compositor/layer.h" |
| 25 #include "ui/display/screen.h" | 25 #include "ui/display/screen.h" |
| 26 #include "ui/gfx/canvas.h" | 26 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/geometry/point_conversions.h" | 27 #include "ui/gfx/geometry/point_conversions.h" |
| 28 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 29 #include "ui/gfx/geometry/size_conversions.h" | 29 #include "ui/gfx/geometry/size_conversions.h" |
| 30 #include "ui/views/corewm/tooltip.h" | 30 #include "ui/views/corewm/tooltip.h" |
| 31 #include "ui/views/corewm/tooltip_controller.h" | 31 #include "ui/views/corewm/tooltip_controller.h" |
| 32 #include "ui/views/drag_utils.h" | 32 #include "ui/views/drag_utils.h" |
| 33 #include "ui/views/view_constants_aura.h" | 33 #include "ui/views/view_constants_aura.h" |
| 34 #include "ui/views/views_delegate.h" |
| 34 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" | 35 #include "ui/views/widget/desktop_aura/desktop_capture_client.h" |
| 35 #include "ui/views/widget/desktop_aura/desktop_event_client.h" | 36 #include "ui/views/widget/desktop_aura/desktop_event_client.h" |
| 36 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" | 37 #include "ui/views/widget/desktop_aura/desktop_focus_rules.h" |
| 37 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 38 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 38 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" | 39 #include "ui/views/widget/desktop_aura/desktop_screen_position_client.h" |
| 39 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" | 40 #include "ui/views/widget/desktop_aura/desktop_window_tree_host.h" |
| 40 #include "ui/views/widget/drop_helper.h" | 41 #include "ui/views/widget/drop_helper.h" |
| 41 #include "ui/views/widget/focus_manager_event_handler.h" | 42 #include "ui/views/widget/focus_manager_event_handler.h" |
| 42 #include "ui/views/widget/native_widget_aura.h" | 43 #include "ui/views/widget/native_widget_aura.h" |
| 43 #include "ui/views/widget/root_view.h" | 44 #include "ui/views/widget/root_view.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // bounds and maximized windows in bad ways. | 409 // bounds and maximized windows in bad ways. |
| 409 if (params.type == Widget::InitParams::TYPE_WINDOW && | 410 if (params.type == Widget::InitParams::TYPE_WINDOW && |
| 410 !params.remove_standard_frame) { | 411 !params.remove_standard_frame) { |
| 411 content_window_->SetProperty(aura::client::kAnimationsDisabledKey, true); | 412 content_window_->SetProperty(aura::client::kAnimationsDisabledKey, true); |
| 412 } | 413 } |
| 413 content_window_->SetType(GetAuraWindowTypeForWidgetType(params.type)); | 414 content_window_->SetType(GetAuraWindowTypeForWidgetType(params.type)); |
| 414 content_window_->Init(params.layer_type); | 415 content_window_->Init(params.layer_type); |
| 415 wm::SetShadowElevation(content_window_, wm::ShadowElevation::NONE); | 416 wm::SetShadowElevation(content_window_, wm::ShadowElevation::NONE); |
| 416 | 417 |
| 417 if (!desktop_window_tree_host_) { | 418 if (!desktop_window_tree_host_) { |
| 418 desktop_window_tree_host_ = | 419 if (params.desktop_window_tree_host) { |
| 419 params.desktop_window_tree_host | 420 desktop_window_tree_host_ = params.desktop_window_tree_host; |
| 420 ? params.desktop_window_tree_host | 421 } else if (!ViewsDelegate::GetInstance() |
| 421 : DesktopWindowTreeHost::Create(native_widget_delegate_, this); | 422 ->desktop_window_tree_host_factory() |
| 423 .is_null()) { |
| 424 desktop_window_tree_host_ = |
| 425 ViewsDelegate::GetInstance() |
| 426 ->desktop_window_tree_host_factory() |
| 427 .Run(params, native_widget_delegate_, this) |
| 428 .release(); |
| 429 } else { |
| 430 desktop_window_tree_host_ = |
| 431 DesktopWindowTreeHost::Create(native_widget_delegate_, this); |
| 432 } |
| 422 host_.reset(desktop_window_tree_host_->AsWindowTreeHost()); | 433 host_.reset(desktop_window_tree_host_->AsWindowTreeHost()); |
| 423 } | 434 } |
| 424 desktop_window_tree_host_->Init(content_window_, params); | 435 desktop_window_tree_host_->Init(content_window_, params); |
| 425 | 436 |
| 426 host_->window()->AddChild(content_window_); | 437 host_->window()->AddChild(content_window_); |
| 427 host_->window()->SetProperty(kDesktopNativeWidgetAuraKey, this); | 438 host_->window()->SetProperty(kDesktopNativeWidgetAuraKey, this); |
| 428 | 439 |
| 429 host_->window()->AddObserver(new RootWindowDestructionObserver(this)); | 440 host_->window()->AddObserver(new RootWindowDestructionObserver(this)); |
| 430 | 441 |
| 431 // The WindowsModalityController event filter should be at the head of the | 442 // The WindowsModalityController event filter should be at the head of the |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 if (cursor_reference_count_ == 0) { | 1208 if (cursor_reference_count_ == 0) { |
| 1198 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1209 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1199 // for cleaning up |cursor_manager_|. | 1210 // for cleaning up |cursor_manager_|. |
| 1200 delete cursor_manager_; | 1211 delete cursor_manager_; |
| 1201 native_cursor_manager_ = NULL; | 1212 native_cursor_manager_ = NULL; |
| 1202 cursor_manager_ = NULL; | 1213 cursor_manager_ = NULL; |
| 1203 } | 1214 } |
| 1204 } | 1215 } |
| 1205 | 1216 |
| 1206 } // namespace views | 1217 } // namespace views |
| OLD | NEW |