OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/views/frame/browser_frame_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_ash.h" |
6 | 6 |
7 #include "ash/wm/window_state.h" | 7 #include "ash/wm/window_state.h" |
8 #include "ash/wm/window_state_delegate.h" | 8 #include "ash/wm/window_state_delegate.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_shutdown.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
15 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
16 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
17 | 18 |
18 using aura::Window; | 19 using aura::Window; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys | 82 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys |
82 // like brightness, volume, etc. Otherwise these keys are handled by the | 83 // like brightness, volume, etc. Otherwise these keys are handled by the |
83 // Ash window manager. | 84 // Ash window manager. |
84 window_state->set_can_consume_system_keys(browser->is_app()); | 85 window_state->set_can_consume_system_keys(browser->is_app()); |
85 #endif // defined(OS_CHROMEOS) | 86 #endif // defined(OS_CHROMEOS) |
86 } | 87 } |
87 | 88 |
88 /////////////////////////////////////////////////////////////////////////////// | 89 /////////////////////////////////////////////////////////////////////////////// |
89 // BrowserFrameAsh, views::NativeWidgetAura overrides: | 90 // BrowserFrameAsh, views::NativeWidgetAura overrides: |
90 | 91 |
| 92 void BrowserFrameAsh::OnWindowDestroying() { |
| 93 // Destroy any remaining WebContents early on. Doing so may result in |
| 94 // calling back to one of the Views/LayoutManagers or supporting classes of |
| 95 // BrowserView. By destroying here we ensure all said classes are valid. |
| 96 DestroyBrowserWebContents(browser_view_->browser()); |
| 97 NativeWidgetAura::OnWindowDestroying(); |
| 98 } |
| 99 |
91 void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) { | 100 void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) { |
92 if (visible) { | 101 if (visible) { |
93 // Once the window has been shown we know the requested bounds | 102 // Once the window has been shown we know the requested bounds |
94 // (if provided) have been honored and we can switch on window management. | 103 // (if provided) have been honored and we can switch on window management. |
95 SetWindowAutoManaged(); | 104 SetWindowAutoManaged(); |
96 } | 105 } |
97 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); | 106 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); |
98 } | 107 } |
99 | 108 |
100 //////////////////////////////////////////////////////////////////////////////// | 109 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 21 matching lines...) Expand all Loading... |
122 /////////////////////////////////////////////////////////////////////////////// | 131 /////////////////////////////////////////////////////////////////////////////// |
123 // BrowserFrameAsh, private: | 132 // BrowserFrameAsh, private: |
124 | 133 |
125 void BrowserFrameAsh::SetWindowAutoManaged() { | 134 void BrowserFrameAsh::SetWindowAutoManaged() { |
126 if (browser_view_->browser()->type() != Browser::TYPE_POPUP || | 135 if (browser_view_->browser()->type() != Browser::TYPE_POPUP || |
127 browser_view_->browser()->is_app()) { | 136 browser_view_->browser()->is_app()) { |
128 ash::wm::GetWindowState(GetNativeWindow())-> | 137 ash::wm::GetWindowState(GetNativeWindow())-> |
129 set_window_position_managed(true); | 138 set_window_position_managed(true); |
130 } | 139 } |
131 } | 140 } |
OLD | NEW |