OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/apps/chrome_native_app_window_views.h" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
6 | 6 |
7 #include "apps/ui/views/app_window_frame_view.h" | 7 #include "apps/ui/views/app_window_frame_view.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/app_mode/app_mode_utils.h" | 10 #include "chrome/browser/app_mode/app_mode_utils.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 window_state_( | 129 window_state_( |
130 ash::wm::GetWindowState(native_app_window->GetNativeWindow())) { | 130 ash::wm::GetWindowState(native_app_window->GetNativeWindow())) { |
131 // Add a window state observer to exit fullscreen properly in case | 131 // Add a window state observer to exit fullscreen properly in case |
132 // fullscreen is exited without going through AppWindow::Restore(). This | 132 // fullscreen is exited without going through AppWindow::Restore(). This |
133 // is the case when exiting immersive fullscreen via the "Restore" window | 133 // is the case when exiting immersive fullscreen via the "Restore" window |
134 // control. | 134 // control. |
135 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 | 135 // TODO(pkotwicz): This is a hack. Remove ASAP. http://crbug.com/319048 |
136 window_state_->AddObserver(this); | 136 window_state_->AddObserver(this); |
137 window_state_->window()->AddObserver(this); | 137 window_state_->window()->AddObserver(this); |
138 } | 138 } |
139 virtual ~NativeAppWindowStateDelegate(){ | 139 virtual ~NativeAppWindowStateDelegate() { |
140 if (window_state_) { | 140 if (window_state_) { |
141 window_state_->RemoveObserver(this); | 141 window_state_->RemoveObserver(this); |
142 window_state_->window()->RemoveObserver(this); | 142 window_state_->window()->RemoveObserver(this); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 private: | 146 private: |
147 // Overridden from ash::wm::WindowStateDelegate. | 147 // Overridden from ash::wm::WindowStateDelegate. |
148 virtual bool ToggleFullscreen(ash::wm::WindowState* window_state) OVERRIDE { | 148 virtual bool ToggleFullscreen(ash::wm::WindowState* window_state) OVERRIDE { |
149 // Windows which cannot be maximized should not be fullscreened. | 149 // Windows which cannot be maximized should not be fullscreened. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // could plumb context through to here in some cases. | 216 // could plumb context through to here in some cases. |
217 init_params.top_level = true; | 217 init_params.top_level = true; |
218 if (create_params.transparent_background) | 218 if (create_params.transparent_background) |
219 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 219 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
220 init_params.keep_on_top = create_params.always_on_top; | 220 init_params.keep_on_top = create_params.always_on_top; |
221 | 221 |
222 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 222 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
223 // Set up a custom WM_CLASS for app windows. This allows task switchers in | 223 // Set up a custom WM_CLASS for app windows. This allows task switchers in |
224 // X11 environments to distinguish them from main browser windows. | 224 // X11 environments to distinguish them from main browser windows. |
225 init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name); | 225 init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name); |
226 init_params.wm_class_class = ShellIntegrationLinux::GetProgramClassName(); | 226 init_params.wm_class_class = shell_integration_linux::GetProgramClassName(); |
227 const char kX11WindowRoleApp[] = "app"; | 227 const char kX11WindowRoleApp[] = "app"; |
228 init_params.wm_role_name = std::string(kX11WindowRoleApp); | 228 init_params.wm_role_name = std::string(kX11WindowRoleApp); |
229 #endif | 229 #endif |
230 | 230 |
231 OnBeforeWidgetInit(&init_params, widget()); | 231 OnBeforeWidgetInit(&init_params, widget()); |
232 widget()->Init(init_params); | 232 widget()->Init(init_params); |
233 | 233 |
234 // The frame insets are required to resolve the bounds specifications | 234 // The frame insets are required to resolve the bounds specifications |
235 // correctly. So we set the window bounds and constraints now. | 235 // correctly. So we set the window bounds and constraints now. |
236 gfx::Insets frame_insets = GetFrameInsets(); | 236 gfx::Insets frame_insets = GetFrameInsets(); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 InitializePanelWindow(create_params); | 712 InitializePanelWindow(create_params); |
713 } else { | 713 } else { |
714 InitializeDefaultWindow(create_params); | 714 InitializeDefaultWindow(create_params); |
715 } | 715 } |
716 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 716 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
717 Profile::FromBrowserContext(app_window->browser_context()), | 717 Profile::FromBrowserContext(app_window->browser_context()), |
718 widget()->GetFocusManager(), | 718 widget()->GetFocusManager(), |
719 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 719 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
720 NULL)); | 720 NULL)); |
721 } | 721 } |
OLD | NEW |