| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "apps/ui/views/app_window_frame_view.h" | 10 #include "apps/ui/views/app_window_frame_view.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 14 #include "chrome/browser/app_mode/app_mode_utils.h" | 14 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" | 16 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "components/favicon/content/content_favicon_driver.h" | 18 #include "components/favicon/content/content_favicon_driver.h" |
| 19 #include "components/zoom/page_zoom.h" | 19 #include "components/zoom/page_zoom.h" |
| 20 #include "components/zoom/zoom_controller.h" | 20 #include "components/zoom/zoom_controller.h" |
| 21 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
| 22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 23 #include "ui/views/controls/webview/webview.h" | 23 #include "ui/views/controls/webview/webview.h" |
| 24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
| 25 | 25 |
| 26 #if defined(OS_CHROMEOS) |
| 27 #include "chrome/browser/ui/ash/metrics/stylus_metrics_recorder_chromeos.h" |
| 28 #endif |
| 29 |
| 26 using extensions::AppWindow; | 30 using extensions::AppWindow; |
| 27 | 31 |
| 28 namespace { | 32 namespace { |
| 29 | 33 |
| 30 const int kMinPanelWidth = 100; | 34 const int kMinPanelWidth = 100; |
| 31 const int kMinPanelHeight = 100; | 35 const int kMinPanelHeight = 100; |
| 32 const int kDefaultPanelWidth = 200; | 36 const int kDefaultPanelWidth = 200; |
| 33 const int kDefaultPanelHeight = 300; | 37 const int kDefaultPanelHeight = 300; |
| 34 | 38 |
| 35 struct AcceleratorMapping { | 39 struct AcceleratorMapping { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (IsFrameless()) | 138 if (IsFrameless()) |
| 135 init_params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; | 139 init_params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; |
| 136 } | 140 } |
| 137 init_params.keep_on_top = create_params.always_on_top; | 141 init_params.keep_on_top = create_params.always_on_top; |
| 138 init_params.visible_on_all_workspaces = | 142 init_params.visible_on_all_workspaces = |
| 139 create_params.visible_on_all_workspaces; | 143 create_params.visible_on_all_workspaces; |
| 140 | 144 |
| 141 OnBeforeWidgetInit(create_params, &init_params, widget()); | 145 OnBeforeWidgetInit(create_params, &init_params, widget()); |
| 142 widget()->Init(init_params); | 146 widget()->Init(init_params); |
| 143 | 147 |
| 148 #if defined(OS_CHROMEOS) |
| 149 widget()->GetNativeWindow()->SetProperty(chromeos::kStylusWindowTypeBucket, |
| 150 chromeos::StylusWindowType::APP); |
| 151 #endif |
| 152 |
| 144 // The frame insets are required to resolve the bounds specifications | 153 // The frame insets are required to resolve the bounds specifications |
| 145 // correctly. So we set the window bounds and constraints now. | 154 // correctly. So we set the window bounds and constraints now. |
| 146 gfx::Insets frame_insets = GetFrameInsets(); | 155 gfx::Insets frame_insets = GetFrameInsets(); |
| 147 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); | 156 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); |
| 148 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), | 157 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), |
| 149 create_params.GetContentMaximumSize(frame_insets)); | 158 create_params.GetContentMaximumSize(frame_insets)); |
| 150 if (!window_bounds.IsEmpty()) { | 159 if (!window_bounds.IsEmpty()) { |
| 151 using BoundsSpecification = AppWindow::BoundsSpecification; | 160 using BoundsSpecification = AppWindow::BoundsSpecification; |
| 152 bool position_specified = | 161 bool position_specified = |
| 153 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && | 162 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 InitializePanelWindow(create_params); | 393 InitializePanelWindow(create_params); |
| 385 } else { | 394 } else { |
| 386 InitializeDefaultWindow(create_params); | 395 InitializeDefaultWindow(create_params); |
| 387 } | 396 } |
| 388 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 397 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
| 389 Profile::FromBrowserContext(app_window->browser_context()), | 398 Profile::FromBrowserContext(app_window->browser_context()), |
| 390 widget()->GetFocusManager(), | 399 widget()->GetFocusManager(), |
| 391 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 400 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 392 NULL)); | 401 NULL)); |
| 393 } | 402 } |
| OLD | NEW |