| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/widget/native_widget_aura.h" | 5 #include "views/widget/native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
| 9 #include "ui/aura/desktop.h" | 9 #include "ui/aura/desktop.h" |
| 10 #include "ui/aura/desktop_observer.h" | 10 #include "ui/aura/desktop_observer.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 void NativeWidgetAura::MoveToTop() { | 344 void NativeWidgetAura::MoveToTop() { |
| 345 window_->parent()->MoveChildToFront(window_); | 345 window_->parent()->MoveChildToFront(window_); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void NativeWidgetAura::SetShape(gfx::NativeRegion region) { | 348 void NativeWidgetAura::SetShape(gfx::NativeRegion region) { |
| 349 // No need for this. | 349 // No need for this. |
| 350 } | 350 } |
| 351 | 351 |
| 352 void NativeWidgetAura::Close() { | 352 void NativeWidgetAura::Close() { |
| 353 Hide(); | 353 // |window_| may already be deleted by parent window. This can happen |
| 354 // when this widget is child widget or has transient parent |
| 355 // and ownership is WIDGET_OWNS_NATIVE_WIDGET. |
| 356 DCHECK(window_ || |
| 357 ownership_ == Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET); |
| 358 if (window_) |
| 359 Hide(); |
| 354 | 360 |
| 355 if (!close_widget_factory_.HasWeakPtrs()) { | 361 if (!close_widget_factory_.HasWeakPtrs()) { |
| 356 MessageLoop::current()->PostTask( | 362 MessageLoop::current()->PostTask( |
| 357 FROM_HERE, | 363 FROM_HERE, |
| 358 base::Bind(&NativeWidgetAura::CloseNow, | 364 base::Bind(&NativeWidgetAura::CloseNow, |
| 359 close_widget_factory_.GetWeakPtr())); | 365 close_widget_factory_.GetWeakPtr())); |
| 360 } | 366 } |
| 361 } | 367 } |
| 362 | 368 |
| 363 void NativeWidgetAura::CloseNow() { | 369 void NativeWidgetAura::CloseNow() { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 NOTIMPLEMENTED(); | 728 NOTIMPLEMENTED(); |
| 723 } | 729 } |
| 724 | 730 |
| 725 // static | 731 // static |
| 726 bool NativeWidgetPrivate::IsMouseButtonDown() { | 732 bool NativeWidgetPrivate::IsMouseButtonDown() { |
| 727 return aura::Desktop::GetInstance()->IsMouseButtonDown(); | 733 return aura::Desktop::GetInstance()->IsMouseButtonDown(); |
| 728 } | 734 } |
| 729 | 735 |
| 730 } // namespace internal | 736 } // namespace internal |
| 731 } // namespace views | 737 } // namespace views |
| OLD | NEW |