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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "ash/wm/window_state.h" | 44 #include "ash/wm/window_state.h" |
45 #include "ash/wm/window_state_delegate.h" | 45 #include "ash/wm/window_state_delegate.h" |
46 #include "ash/wm/window_state_observer.h" | 46 #include "ash/wm/window_state_observer.h" |
47 #include "chrome/browser/ui/ash/ash_util.h" | 47 #include "chrome/browser/ui/ash/ash_util.h" |
48 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" | 48 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" |
49 #include "ui/aura/client/aura_constants.h" | 49 #include "ui/aura/client/aura_constants.h" |
50 #include "ui/aura/client/window_tree_client.h" | 50 #include "ui/aura/client/window_tree_client.h" |
51 #include "ui/aura/window_observer.h" | 51 #include "ui/aura/window_observer.h" |
52 #endif | 52 #endif |
53 | 53 |
54 using apps::AppWindow; | 54 using extensions::AppWindow; |
55 | 55 |
56 namespace { | 56 namespace { |
57 | 57 |
58 const int kMinPanelWidth = 100; | 58 const int kMinPanelWidth = 100; |
59 const int kMinPanelHeight = 100; | 59 const int kMinPanelHeight = 100; |
60 const int kDefaultPanelWidth = 200; | 60 const int kDefaultPanelWidth = 200; |
61 const int kDefaultPanelHeight = 300; | 61 const int kDefaultPanelHeight = 300; |
62 | 62 |
63 struct AcceleratorMapping { | 63 struct AcceleratorMapping { |
64 ui::KeyboardCode keycode; | 64 ui::KeyboardCode keycode; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 OnBeforeWidgetInit(&init_params, widget()); | 228 OnBeforeWidgetInit(&init_params, widget()); |
229 widget()->Init(init_params); | 229 widget()->Init(init_params); |
230 | 230 |
231 // The frame insets are required to resolve the bounds specifications | 231 // The frame insets are required to resolve the bounds specifications |
232 // correctly. So we set the window bounds and constraints now. | 232 // correctly. So we set the window bounds and constraints now. |
233 gfx::Insets frame_insets = GetFrameInsets(); | 233 gfx::Insets frame_insets = GetFrameInsets(); |
234 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); | 234 gfx::Rect window_bounds = create_params.GetInitialWindowBounds(frame_insets); |
235 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), | 235 SetContentSizeConstraints(create_params.GetContentMinimumSize(frame_insets), |
236 create_params.GetContentMaximumSize(frame_insets)); | 236 create_params.GetContentMaximumSize(frame_insets)); |
237 if (!window_bounds.IsEmpty()) { | 237 if (!window_bounds.IsEmpty()) { |
238 typedef apps::AppWindow::BoundsSpecification BoundsSpecification; | 238 typedef AppWindow::BoundsSpecification BoundsSpecification; |
239 bool position_specified = | 239 bool position_specified = |
240 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && | 240 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
241 window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; | 241 window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; |
242 if (!position_specified) | 242 if (!position_specified) |
243 widget()->CenterWindow(window_bounds.size()); | 243 widget()->CenterWindow(window_bounds.size()); |
244 else | 244 else |
245 widget()->SetBounds(window_bounds); | 245 widget()->SetBounds(window_bounds); |
246 } | 246 } |
247 | 247 |
248 if (IsFrameless() && | 248 if (IsFrameless() && |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 InitializePanelWindow(create_params); | 668 InitializePanelWindow(create_params); |
669 } else { | 669 } else { |
670 InitializeDefaultWindow(create_params); | 670 InitializeDefaultWindow(create_params); |
671 } | 671 } |
672 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 672 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
673 Profile::FromBrowserContext(app_window->browser_context()), | 673 Profile::FromBrowserContext(app_window->browser_context()), |
674 widget()->GetFocusManager(), | 674 widget()->GetFocusManager(), |
675 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 675 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
676 NULL)); | 676 NULL)); |
677 } | 677 } |
OLD | NEW |