| 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" | |
| 18 #include "components/favicon/content/content_favicon_driver.h" | 17 #include "components/favicon/content/content_favicon_driver.h" |
| 19 #include "components/zoom/page_zoom.h" | 18 #include "components/zoom/page_zoom.h" |
| 20 #include "components/zoom/zoom_controller.h" | 19 #include "components/zoom/zoom_controller.h" |
| 21 #include "ui/aura/client/aura_constants.h" | |
| 22 #include "ui/aura/window.h" | |
| 23 #include "ui/views/controls/webview/webview.h" | 20 #include "ui/views/controls/webview/webview.h" |
| 24 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 25 | 22 |
| 26 using extensions::AppWindow; | 23 using extensions::AppWindow; |
| 27 | 24 |
| 28 namespace { | 25 namespace { |
| 29 | 26 |
| 30 const int kMinPanelWidth = 100; | 27 const int kMinPanelWidth = 100; |
| 31 const int kMinPanelHeight = 100; | 28 const int kMinPanelHeight = 100; |
| 32 const int kDefaultPanelWidth = 200; | 29 const int kDefaultPanelWidth = 200; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 using BoundsSpecification = AppWindow::BoundsSpecification; | 220 using BoundsSpecification = AppWindow::BoundsSpecification; |
| 224 bool position_specified = | 221 bool position_specified = |
| 225 initial_window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && | 222 initial_window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && |
| 226 initial_window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; | 223 initial_window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; |
| 227 params.bounds = (use_default_bounds || !position_specified) ? | 224 params.bounds = (use_default_bounds || !position_specified) ? |
| 228 gfx::Rect(preferred_size_) : | 225 gfx::Rect(preferred_size_) : |
| 229 gfx::Rect(initial_window_bounds.origin(), preferred_size_); | 226 gfx::Rect(initial_window_bounds.origin(), preferred_size_); |
| 230 OnBeforePanelWidgetInit(use_default_bounds, ¶ms, widget()); | 227 OnBeforePanelWidgetInit(use_default_bounds, ¶ms, widget()); |
| 231 widget()->Init(params); | 228 widget()->Init(params); |
| 232 widget()->set_focus_on_creation(create_params.focused); | 229 widget()->set_focus_on_creation(create_params.focused); |
| 233 #if defined(OS_CHROMEOS) | |
| 234 if (extension_misc::IsImeMenuExtensionId(app_window()->extension_id())) { | |
| 235 if (widget()->GetNativeView()) { | |
| 236 widget()->GetNativeView()->SetProperty(aura::client::kExcludeFromMruKey, | |
| 237 true); | |
| 238 } | |
| 239 } | |
| 240 #endif | |
| 241 } | 230 } |
| 242 | 231 |
| 243 views::NonClientFrameView* | 232 views::NonClientFrameView* |
| 244 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { | 233 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { |
| 245 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); | 234 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); |
| 246 } | 235 } |
| 247 | 236 |
| 248 // ui::BaseWindow implementation. | 237 // ui::BaseWindow implementation. |
| 249 | 238 |
| 250 gfx::Rect ChromeNativeAppWindowViews::GetRestoredBounds() const { | 239 gfx::Rect ChromeNativeAppWindowViews::GetRestoredBounds() const { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 InitializePanelWindow(create_params); | 373 InitializePanelWindow(create_params); |
| 385 } else { | 374 } else { |
| 386 InitializeDefaultWindow(create_params); | 375 InitializeDefaultWindow(create_params); |
| 387 } | 376 } |
| 388 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 377 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
| 389 Profile::FromBrowserContext(app_window->browser_context()), | 378 Profile::FromBrowserContext(app_window->browser_context()), |
| 390 widget()->GetFocusManager(), | 379 widget()->GetFocusManager(), |
| 391 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 380 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 392 NULL)); | 381 NULL)); |
| 393 } | 382 } |
| OLD | NEW |