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 const bool use_default_bounds = true; |
220 bool use_default_bounds = create_params.state != ui::SHOW_STATE_DOCKED; | 220 params.bounds = gfx::Rect(preferred_size_); |
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()); | 221 OnBeforePanelWidgetInit(use_default_bounds, ¶ms, widget()); |
oshima
2017/02/22 06:49:07
use_default_bounds is always true now. Can we remo
afakhry
2017/02/22 22:04:43
Done.
| |
230 widget()->Init(params); | 222 widget()->Init(params); |
231 widget()->set_focus_on_creation(create_params.focused); | 223 widget()->set_focus_on_creation(create_params.focused); |
232 } | 224 } |
233 | 225 |
234 views::NonClientFrameView* | 226 views::NonClientFrameView* |
235 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { | 227 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { |
236 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); | 228 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); |
237 } | 229 } |
238 | 230 |
239 // ui::BaseWindow implementation. | 231 // ui::BaseWindow implementation. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 InitializePanelWindow(create_params); | 367 InitializePanelWindow(create_params); |
376 } else { | 368 } else { |
377 InitializeDefaultWindow(create_params); | 369 InitializeDefaultWindow(create_params); |
378 } | 370 } |
379 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( | 371 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( |
380 Profile::FromBrowserContext(app_window->browser_context()), | 372 Profile::FromBrowserContext(app_window->browser_context()), |
381 widget()->GetFocusManager(), | 373 widget()->GetFocusManager(), |
382 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, | 374 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, |
383 NULL)); | 375 NULL)); |
384 } | 376 } |
OLD | NEW |