| 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/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 void NativeWidgetAura::ShowMaximizedWithBounds( | 527 void NativeWidgetAura::ShowMaximizedWithBounds( |
| 528 const gfx::Rect& restored_bounds) { | 528 const gfx::Rect& restored_bounds) { |
| 529 SetRestoreBounds(window_, restored_bounds); | 529 SetRestoreBounds(window_, restored_bounds); |
| 530 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); | 530 ShowWithWindowState(ui::SHOW_STATE_MAXIMIZED); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { | 533 void NativeWidgetAura::ShowWithWindowState(ui::WindowShowState state) { |
| 534 if (!window_) | 534 if (!window_) |
| 535 return; | 535 return; |
| 536 | 536 |
| 537 // TODO(afakhry): Remove Docked Windows in M58. |
| 537 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN || | 538 if (state == ui::SHOW_STATE_MAXIMIZED || state == ui::SHOW_STATE_FULLSCREEN || |
| 538 state == ui::SHOW_STATE_DOCKED) { | 539 state == ui::SHOW_STATE_DOCKED) { |
| 539 window_->SetProperty(aura::client::kShowStateKey, state); | 540 window_->SetProperty(aura::client::kShowStateKey, state); |
| 540 } | 541 } |
| 541 window_->Show(); | 542 window_->Show(); |
| 542 if (delegate_->CanActivate()) { | 543 if (delegate_->CanActivate()) { |
| 543 if (state != ui::SHOW_STATE_INACTIVE) | 544 if (state != ui::SHOW_STATE_INACTIVE) |
| 544 Activate(); | 545 Activate(); |
| 545 // SetInitialFocus() should be always be called, even for | 546 // SetInitialFocus() should be always be called, even for |
| 546 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will | 547 // SHOW_STATE_INACTIVE. If the window has to stay inactive, the method will |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 destroying_ = true; | 986 destroying_ = true; |
| 986 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) | 987 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) |
| 987 delete delegate_; | 988 delete delegate_; |
| 988 else | 989 else |
| 989 CloseNow(); | 990 CloseNow(); |
| 990 } | 991 } |
| 991 | 992 |
| 992 //////////////////////////////////////////////////////////////////////////////// | 993 //////////////////////////////////////////////////////////////////////////////// |
| 993 // NativeWidgetAura, private: | 994 // NativeWidgetAura, private: |
| 994 | 995 |
| 996 // TODO(afakhry): Remove Docked Windows in M58. |
| 995 bool NativeWidgetAura::IsDocked() const { | 997 bool NativeWidgetAura::IsDocked() const { |
| 996 return window_ && | 998 return window_ && |
| 997 window_->GetProperty(aura::client::kShowStateKey) == | 999 window_->GetProperty(aura::client::kShowStateKey) == |
| 998 ui::SHOW_STATE_DOCKED; | 1000 ui::SHOW_STATE_DOCKED; |
| 999 } | 1001 } |
| 1000 | 1002 |
| 1001 void NativeWidgetAura::SetInitialFocus(ui::WindowShowState show_state) { | 1003 void NativeWidgetAura::SetInitialFocus(ui::WindowShowState show_state) { |
| 1002 // The window does not get keyboard messages unless we focus it. | 1004 // The window does not get keyboard messages unless we focus it. |
| 1003 if (!GetWidget()->SetInitialFocus(show_state)) | 1005 if (!GetWidget()->SetInitialFocus(show_state)) |
| 1004 window_->Focus(); | 1006 window_->Focus(); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 gfx::NativeView native_view) { | 1205 gfx::NativeView native_view) { |
| 1204 aura::client::CaptureClient* capture_client = | 1206 aura::client::CaptureClient* capture_client = |
| 1205 aura::client::GetCaptureClient(native_view->GetRootWindow()); | 1207 aura::client::GetCaptureClient(native_view->GetRootWindow()); |
| 1206 if (!capture_client) | 1208 if (!capture_client) |
| 1207 return nullptr; | 1209 return nullptr; |
| 1208 return capture_client->GetGlobalCaptureWindow(); | 1210 return capture_client->GetGlobalCaptureWindow(); |
| 1209 } | 1211 } |
| 1210 | 1212 |
| 1211 } // namespace internal | 1213 } // namespace internal |
| 1212 } // namespace views | 1214 } // namespace views |
| OLD | NEW |