| 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" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (preferred_size_.width() == 0) | 207 if (preferred_size_.width() == 0) |
| 208 preferred_size_.set_width(kDefaultPanelWidth); | 208 preferred_size_.set_width(kDefaultPanelWidth); |
| 209 else if (preferred_size_.width() < kMinPanelWidth) | 209 else if (preferred_size_.width() < kMinPanelWidth) |
| 210 preferred_size_.set_width(kMinPanelWidth); | 210 preferred_size_.set_width(kMinPanelWidth); |
| 211 | 211 |
| 212 if (preferred_size_.height() == 0) | 212 if (preferred_size_.height() == 0) |
| 213 preferred_size_.set_height(kDefaultPanelHeight); | 213 preferred_size_.set_height(kDefaultPanelHeight); |
| 214 else if (preferred_size_.height() < kMinPanelHeight) | 214 else if (preferred_size_.height() < kMinPanelHeight) |
| 215 preferred_size_.set_height(kMinPanelHeight); | 215 preferred_size_.set_height(kMinPanelHeight); |
| 216 | 216 |
| 217 // When a panel is not docked it will be placed at a default origin in the | 217 // A panel will be placed at a default origin in the currently active target |
| 218 // currently active target root window. | 218 // root window. |
| 219 // TODO(afakhry): Remove Docked Windows in M58. | 219 params.bounds = gfx::Rect(preferred_size_); |
| 220 bool use_default_bounds = create_params.state != ui::SHOW_STATE_DOCKED; | 220 OnBeforePanelWidgetInit(true /* use_default_bounds */, ¶ms, widget()); |
| 221 // Sanitize initial origin reseting it in case it was not specified. | |
| 222 using BoundsSpecification = AppWindow::BoundsSpecification; | |
| 223 bool position_specified = | |
| 224 initial_window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && | |
| 225 initial_window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; | |
| 226 params.bounds = (use_default_bounds || !position_specified) ? | |
| 227 gfx::Rect(preferred_size_) : | |
| 228 gfx::Rect(initial_window_bounds.origin(), preferred_size_); | |
| 229 OnBeforePanelWidgetInit(use_default_bounds, ¶ms, widget()); | |
| 230 widget()->Init(params); | 221 widget()->Init(params); |
| 231 widget()->set_focus_on_creation(create_params.focused); | 222 widget()->set_focus_on_creation(create_params.focused); |
| 232 } | 223 } |
| 233 | 224 |
| 234 views::NonClientFrameView* | 225 views::NonClientFrameView* |
| 235 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { | 226 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { |
| 236 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); | 227 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); |
| 237 } | 228 } |
| 238 | 229 |
| 239 // ui::BaseWindow implementation. | 230 // ui::BaseWindow implementation. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 InitializePanelWindow(create_params); | 366 InitializePanelWindow(create_params); |
| 376 } else { | 367 } else { |
| 377 InitializeDefaultWindow(create_params); | 368 InitializeDefaultWindow(create_params); |
| 378 } | 369 } |
| 379 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 370 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
| 380 Profile::FromBrowserContext(app_window->browser_context()), | 371 Profile::FromBrowserContext(app_window->browser_context()), |
| 381 widget()->GetFocusManager(), | 372 widget()->GetFocusManager(), |
| 382 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 373 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
| 383 NULL)); | 374 NULL)); |
| 384 } | 375 } |
| OLD | NEW |