Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: chrome/browser/ui/views/frame/browser_frame_ash.cc

Issue 2015223002: MacViews: Fixed BrowserViewTest.CloseWithTabsStartWithActive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove DestroyBrowserWebContents. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/common/window_state.h" 8 #include "ash/wm/common/window_state.h"
9 #include "ash/wm/common/window_state_delegate.h" 9 #include "ash/wm/common/window_state_delegate.h"
10 #include "ash/wm/window_properties.h" 10 #include "ash/wm/window_properties.h"
11 #include "ash/wm/window_state_aura.h" 11 #include "ash/wm/window_state_aura.h"
12 #include "ash/wm/window_util.h" 12 #include "ash/wm/window_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/browser_finder.h" 16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/views/frame/browser_shutdown.h"
18 #include "chrome/browser/ui/views/frame/browser_view.h" 17 #include "chrome/browser/ui/views/frame/browser_view.h"
19 #include "ui/aura/client/aura_constants.h" 18 #include "ui/aura/client/aura_constants.h"
20 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
21 #include "ui/aura/window_observer.h" 20 #include "ui/aura/window_observer.h"
22 #include "ui/views/view.h" 21 #include "ui/views/view.h"
23 22
24 namespace { 23 namespace {
25 24
26 // BrowserWindowStateDelegate class handles a user's fullscreen 25 // BrowserWindowStateDelegate class handles a user's fullscreen
27 // request (Shift+F4/F4). 26 // request (Shift+F4/F4).
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys 74 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys
76 // like brightness, volume, etc. Otherwise these keys are handled by the 75 // like brightness, volume, etc. Otherwise these keys are handled by the
77 // Ash window manager. 76 // Ash window manager.
78 window_state->set_can_consume_system_keys(browser->is_app()); 77 window_state->set_can_consume_system_keys(browser->is_app());
79 #endif // defined(OS_CHROMEOS) 78 #endif // defined(OS_CHROMEOS)
80 } 79 }
81 80
82 /////////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////////
83 // BrowserFrameAsh, views::NativeWidgetAura overrides: 82 // BrowserFrameAsh, views::NativeWidgetAura overrides:
84 83
85 void BrowserFrameAsh::OnWindowDestroying(aura::Window* window) {
86 // Destroy any remaining WebContents early on. Doing so may result in
87 // calling back to one of the Views/LayoutManagers or supporting classes of
88 // BrowserView. By destroying here we ensure all said classes are valid.
89 DestroyBrowserWebContents(browser_view_->browser());
90 NativeWidgetAura::OnWindowDestroying(window);
91 }
92
93 void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) { 84 void BrowserFrameAsh::OnWindowTargetVisibilityChanged(bool visible) {
94 if (visible) { 85 if (visible) {
95 // Once the window has been shown we know the requested bounds 86 // Once the window has been shown we know the requested bounds
96 // (if provided) have been honored and we can switch on window management. 87 // (if provided) have been honored and we can switch on window management.
97 SetWindowAutoManaged(); 88 SetWindowAutoManaged();
98 } 89 }
99 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible); 90 views::NativeWidgetAura::OnWindowTargetVisibilityChanged(visible);
100 } 91 }
101 92
102 bool BrowserFrameAsh::ShouldSaveWindowPlacement() const { 93 bool BrowserFrameAsh::ShouldSaveWindowPlacement() const {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 /////////////////////////////////////////////////////////////////////////////// 164 ///////////////////////////////////////////////////////////////////////////////
174 // BrowserFrameAsh, private: 165 // BrowserFrameAsh, private:
175 166
176 void BrowserFrameAsh::SetWindowAutoManaged() { 167 void BrowserFrameAsh::SetWindowAutoManaged() {
177 if (!browser_view_->browser()->is_type_popup() || 168 if (!browser_view_->browser()->is_type_popup() ||
178 browser_view_->browser()->is_app()) { 169 browser_view_->browser()->is_app()) {
179 ash::wm::GetWindowState(GetNativeWindow())-> 170 ash::wm::GetWindowState(GetNativeWindow())->
180 set_window_position_managed(true); 171 set_window_position_managed(true);
181 } 172 }
182 } 173 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame_ash.h ('k') | chrome/browser/ui/views/frame/browser_frame_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698