| 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/location.h" |
| 8 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 11 #include "third_party/skia/include/core/SkRegion.h" | 14 #include "third_party/skia/include/core/SkRegion.h" |
| 12 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 13 #include "ui/aura/client/capture_client.h" | 16 #include "ui/aura/client/capture_client.h" |
| 14 #include "ui/aura/client/cursor_client.h" | 17 #include "ui/aura/client/cursor_client.h" |
| 15 #include "ui/aura/client/focus_client.h" | 18 #include "ui/aura/client/focus_client.h" |
| 16 #include "ui/aura/client/screen_position_client.h" | 19 #include "ui/aura/client/screen_position_client.h" |
| 17 #include "ui/aura/client/window_tree_client.h" | 20 #include "ui/aura/client/window_tree_client.h" |
| 18 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 19 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // and ownership is WIDGET_OWNS_NATIVE_WIDGET. | 461 // and ownership is WIDGET_OWNS_NATIVE_WIDGET. |
| 459 DCHECK(window_ || | 462 DCHECK(window_ || |
| 460 ownership_ == Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); | 463 ownership_ == Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); |
| 461 if (window_) { | 464 if (window_) { |
| 462 window_->SuppressPaint(); | 465 window_->SuppressPaint(); |
| 463 Hide(); | 466 Hide(); |
| 464 window_->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_NONE); | 467 window_->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_NONE); |
| 465 } | 468 } |
| 466 | 469 |
| 467 if (!close_widget_factory_.HasWeakPtrs()) { | 470 if (!close_widget_factory_.HasWeakPtrs()) { |
| 468 base::MessageLoop::current()->PostTask( | 471 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 469 FROM_HERE, | 472 FROM_HERE, base::Bind(&NativeWidgetAura::CloseNow, |
| 470 base::Bind(&NativeWidgetAura::CloseNow, | 473 close_widget_factory_.GetWeakPtr())); |
| 471 close_widget_factory_.GetWeakPtr())); | |
| 472 } | 474 } |
| 473 } | 475 } |
| 474 | 476 |
| 475 void NativeWidgetAura::CloseNow() { | 477 void NativeWidgetAura::CloseNow() { |
| 476 delete window_; | 478 delete window_; |
| 477 } | 479 } |
| 478 | 480 |
| 479 void NativeWidgetAura::Show() { | 481 void NativeWidgetAura::Show() { |
| 480 ShowWithWindowState(ui::SHOW_STATE_NORMAL); | 482 ShowWithWindowState(ui::SHOW_STATE_NORMAL); |
| 481 } | 483 } |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 gfx::NativeView native_view) { | 1180 gfx::NativeView native_view) { |
| 1179 aura::client::CaptureClient* capture_client = | 1181 aura::client::CaptureClient* capture_client = |
| 1180 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1182 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1181 if (!capture_client) | 1183 if (!capture_client) |
| 1182 return nullptr; | 1184 return nullptr; |
| 1183 return capture_client->GetGlobalCaptureWindow(); | 1185 return capture_client->GetGlobalCaptureWindow(); |
| 1184 } | 1186 } |
| 1185 | 1187 |
| 1186 } // namespace internal | 1188 } // namespace internal |
| 1187 } // namespace views | 1189 } // namespace views |
| OLD | NEW |