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 "ash/shared/app_types.h" | |
28 #include "chrome/browser/chromeos/note_taking_app_utils.h" | |
29 #endif | |
30 | |
26 using extensions::AppWindow; | 31 using extensions::AppWindow; |
27 | 32 |
28 namespace { | 33 namespace { |
29 | 34 |
30 const int kMinPanelWidth = 100; | 35 const int kMinPanelWidth = 100; |
31 const int kMinPanelHeight = 100; | 36 const int kMinPanelHeight = 100; |
32 const int kDefaultPanelWidth = 200; | 37 const int kDefaultPanelWidth = 200; |
33 const int kDefaultPanelHeight = 300; | 38 const int kDefaultPanelHeight = 300; |
34 | 39 |
35 struct AcceleratorMapping { | 40 struct AcceleratorMapping { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 if (IsFrameless()) | 139 if (IsFrameless()) |
135 init_params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; | 140 init_params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; |
136 } | 141 } |
137 init_params.keep_on_top = create_params.always_on_top; | 142 init_params.keep_on_top = create_params.always_on_top; |
138 init_params.visible_on_all_workspaces = | 143 init_params.visible_on_all_workspaces = |
139 create_params.visible_on_all_workspaces; | 144 create_params.visible_on_all_workspaces; |
140 | 145 |
141 OnBeforeWidgetInit(create_params, &init_params, widget()); | 146 OnBeforeWidgetInit(create_params, &init_params, widget()); |
142 widget()->Init(init_params); | 147 widget()->Init(init_params); |
143 | 148 |
149 #if defined(OS_CHROMEOS) | |
150 ash::AppType appType = ash::AppType::CHROME_APP; | |
Daniel Erat
2016/09/27 19:15:10
s/appType/app_type/
xiaoyinh(OOO Sep 11-29)
2016/09/29 20:37:43
Done. I've moved this logic to chrome_native_app_w
| |
151 Profile* profile = | |
152 Profile::FromBrowserContext(app_window()->browser_context()); | |
153 if (profile && chromeos::IsNoteTakingApp(app_window(), profile)) | |
154 appType = ash::AppType::DEFAULT_NOTE_TAKING_APP; | |
155 widget()->GetNativeWindow()->SetProperty(aura::client::kAppType, | |
156 static_cast<int>(appType)); | |
157 #endif | |
158 | |
144 // The frame insets are required to resolve the bounds specifications | 159 // The frame insets are required to resolve the bounds specifications |
145 // correctly. So we set the window bounds and constraints now. | 160 // correctly. So we set the window bounds and constraints now. |
146 gfx::Insets frame_insets = GetFrameInsets(); | 161 gfx::Insets frame_insets = GetFrameInsets(); |
147 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); | 162 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); |
148 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), | 163 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), |
149 create_params.GetContentMaximumSize(frame_insets)); | 164 create_params.GetContentMaximumSize(frame_insets)); |
150 if (!window_bounds.IsEmpty()) { | 165 if (!window_bounds.IsEmpty()) { |
151 using BoundsSpecification = AppWindow::BoundsSpecification; | 166 using BoundsSpecification = AppWindow::BoundsSpecification; |
152 bool position_specified = | 167 bool position_specified = |
153 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && | 168 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 InitializePanelWindow(create_params); | 399 InitializePanelWindow(create_params); |
385 } else { | 400 } else { |
386 InitializeDefaultWindow(create_params); | 401 InitializeDefaultWindow(create_params); |
387 } | 402 } |
388 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 403 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
389 Profile::FromBrowserContext(app_window->browser_context()), | 404 Profile::FromBrowserContext(app_window->browser_context()), |
390 widget()->GetFocusManager(), | 405 widget()->GetFocusManager(), |
391 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 406 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
392 NULL)); | 407 NULL)); |
393 } | 408 } |
OLD | NEW |