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

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

Issue 42353002: Introduce WindowStateDelegate::ToggleFullscreen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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/wm/window_state.h" 7 #include "ash/wm/window_state.h"
8 #include "ash/wm/window_util.h" 8 #include "ash/wm/window_util.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // static 79 // static
80 const char BrowserFrameAsh::kWindowName[] = "BrowserFrameAsh"; 80 const char BrowserFrameAsh::kWindowName[] = "BrowserFrameAsh";
81 81
82 BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame, 82 BrowserFrameAsh::BrowserFrameAsh(BrowserFrame* browser_frame,
83 BrowserView* browser_view) 83 BrowserView* browser_view)
84 : views::NativeWidgetAura(browser_frame), 84 : views::NativeWidgetAura(browser_frame),
85 browser_view_(browser_view), 85 browser_view_(browser_view),
86 window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) { 86 window_property_watcher_(new WindowPropertyWatcher(this, browser_frame)) {
87 GetNativeWindow()->SetName(kWindowName); 87 GetNativeWindow()->SetName(kWindowName);
88 GetNativeWindow()->AddObserver(window_property_watcher_.get()); 88 GetNativeWindow()->AddObserver(window_property_watcher_.get());
89 if (browser_view->browser()->is_type_tabbed()) 89 Browser* browser = browser_view->browser();
90 ash::wm::SetAnimateToFullscreen(GetNativeWindow(), false); 90 ash::wm::WindowState* window_state =
91 ash::wm::GetWindowState(GetNativeWindow());
92
93 window_state->set_animate_to_fullscreen(!browser->is_type_tabbed());
94
95 // AppNonClientFrameViewAsh shows only the window controls and no other
96 // window decorations which is pretty close to fullscreen. Put v1 apps
97 // into maximized mode instead of fullscreen to avoid showing the ugly
98 // fullscreen exit bubble.
99 window_state->set_maximize_when_fullscreen(
100 browser->is_app() && browser->app_type() != Browser::APP_TYPE_CHILD);
91 101
92 // Turn on auto window management if we don't need an explicit bounds. 102 // Turn on auto window management if we don't need an explicit bounds.
93 // This way the requested bounds are honored. 103 // This way the requested bounds are honored.
94 if (!browser_view->browser()->bounds_overridden() && 104 if (!browser_view->browser()->bounds_overridden() &&
95 !browser_view->browser()->is_session_restore()) 105 !browser_view->browser()->is_session_restore())
96 SetWindowAutoManaged(); 106 SetWindowAutoManaged();
97 #if defined(OS_CHROMEOS) 107 #if defined(OS_CHROMEOS)
98 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys 108 // For legacy reasons v1 apps (like Secure Shell) are allowed to consume keys
99 // like brightness, volume, etc. Otherwise these keys are handled by the 109 // like brightness, volume, etc. Otherwise these keys are handled by the
100 // Ash window manager. 110 // Ash window manager.
101 if (browser_view->browser()->is_app()) { 111 window_state->set_can_consume_system_keys(browser_view->browser()->is_app());
102 ash::wm::GetWindowState(GetNativeWindow())->
103 set_can_consume_system_keys(true);
104 }
105 #endif // defined(OS_CHROMEOS) 112 #endif // defined(OS_CHROMEOS)
106 } 113 }
107 114
108 /////////////////////////////////////////////////////////////////////////////// 115 ///////////////////////////////////////////////////////////////////////////////
109 // BrowserFrameAsh, views::NativeWidgetAura overrides: 116 // BrowserFrameAsh, views::NativeWidgetAura overrides:
110 117
111 void BrowserFrameAsh::OnWindowDestroying() { 118 void BrowserFrameAsh::OnWindowDestroying() {
112 // Window is destroyed before our destructor is called, so clean up our 119 // Window is destroyed before our destructor is called, so clean up our
113 // observer here. 120 // observer here.
114 GetNativeWindow()->RemoveObserver(window_property_watcher_.get()); 121 GetNativeWindow()->RemoveObserver(window_property_watcher_.get());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 BrowserFrameAsh::~BrowserFrameAsh() { 159 BrowserFrameAsh::~BrowserFrameAsh() {
153 } 160 }
154 161
155 void BrowserFrameAsh::SetWindowAutoManaged() { 162 void BrowserFrameAsh::SetWindowAutoManaged() {
156 if (browser_view_->browser()->type() != Browser::TYPE_POPUP || 163 if (browser_view_->browser()->type() != Browser::TYPE_POPUP ||
157 browser_view_->browser()->is_app()) { 164 browser_view_->browser()->is_app()) {
158 ash::wm::GetWindowState(GetNativeWindow())-> 165 ash::wm::GetWindowState(GetNativeWindow())->
159 set_window_position_managed(true); 166 set_window_position_managed(true);
160 } 167 }
161 } 168 }
OLDNEW
« ash/wm/window_state.h ('K') | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698