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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 void ChromeNativeAppWindowViews::InitializeDefaultWindow( | 206 void ChromeNativeAppWindowViews::InitializeDefaultWindow( |
207 const AppWindow::CreateParams& create_params) { | 207 const AppWindow::CreateParams& create_params) { |
208 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( | 208 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( |
209 app_window()->extension_id()); | 209 app_window()->extension_id()); |
210 | 210 |
211 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); | 211 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); |
212 init_params.delegate = this; | 212 init_params.delegate = this; |
213 init_params.remove_standard_frame = IsFrameless() || has_frame_color_; | 213 init_params.remove_standard_frame = IsFrameless() || has_frame_color_; |
214 init_params.use_system_default_icon = true; | 214 init_params.use_system_default_icon = true; |
215 // TODO(erg): Conceptually, these are toplevel windows, but we theoretically | |
216 // could plumb context through to here in some cases. | |
217 init_params.top_level = true; | |
218 if (create_params.transparent_background) | 215 if (create_params.transparent_background) |
219 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 216 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
220 init_params.keep_on_top = create_params.always_on_top; | 217 init_params.keep_on_top = create_params.always_on_top; |
221 | 218 |
222 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 219 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
223 // Set up a custom WM_CLASS for app windows. This allows task switchers in | 220 // Set up a custom WM_CLASS for app windows. This allows task switchers in |
224 // X11 environments to distinguish them from main browser windows. | 221 // X11 environments to distinguish them from main browser windows. |
225 init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name); | 222 init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name); |
226 init_params.wm_class_class = ShellIntegrationLinux::GetProgramClassName(); | 223 init_params.wm_class_class = ShellIntegrationLinux::GetProgramClassName(); |
227 const char kX11WindowRoleApp[] = "app"; | 224 const char kX11WindowRoleApp[] = "app"; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Open a new panel on the target root. | 307 // Open a new panel on the target root. |
311 aura::Window* target = ash::Shell::GetTargetRootWindow(); | 308 aura::Window* target = ash::Shell::GetTargetRootWindow(); |
312 params.bounds = ash::ScreenUtil::ConvertRectToScreen( | 309 params.bounds = ash::ScreenUtil::ConvertRectToScreen( |
313 target, gfx::Rect(preferred_size_)); | 310 target, gfx::Rect(preferred_size_)); |
314 } else { | 311 } else { |
315 params.bounds = gfx::Rect(preferred_size_); | 312 params.bounds = gfx::Rect(preferred_size_); |
316 } | 313 } |
317 #else | 314 #else |
318 params.bounds = gfx::Rect(preferred_size_); | 315 params.bounds = gfx::Rect(preferred_size_); |
319 #endif | 316 #endif |
320 // TODO(erg): Conceptually, these are toplevel windows, but we theoretically | |
321 // could plumb context through to here in some cases. | |
322 params.top_level = true; | |
323 widget()->Init(params); | 317 widget()->Init(params); |
324 widget()->set_focus_on_creation(create_params.focused); | 318 widget()->set_focus_on_creation(create_params.focused); |
325 | 319 |
326 #if defined(USE_ASH) | 320 #if defined(USE_ASH) |
327 if (create_params.state == ui::SHOW_STATE_DETACHED) { | 321 if (create_params.state == ui::SHOW_STATE_DETACHED) { |
328 gfx::Rect window_bounds(initial_window_bounds.x(), | 322 gfx::Rect window_bounds(initial_window_bounds.x(), |
329 initial_window_bounds.y(), | 323 initial_window_bounds.y(), |
330 preferred_size_.width(), | 324 preferred_size_.width(), |
331 preferred_size_.height()); | 325 preferred_size_.height()); |
332 aura::Window* native_window = GetNativeWindow(); | 326 aura::Window* native_window = GetNativeWindow(); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 InitializePanelWindow(create_params); | 706 InitializePanelWindow(create_params); |
713 } else { | 707 } else { |
714 InitializeDefaultWindow(create_params); | 708 InitializeDefaultWindow(create_params); |
715 } | 709 } |
716 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 710 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
717 Profile::FromBrowserContext(app_window->browser_context()), | 711 Profile::FromBrowserContext(app_window->browser_context()), |
718 widget()->GetFocusManager(), | 712 widget()->GetFocusManager(), |
719 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 713 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
720 NULL)); | 714 NULL)); |
721 } | 715 } |
OLD | NEW |