Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views.cc

Issue 1056793006: [Docking] Persists docked state on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [Docking] Makes docked state persistent on Chrome OS Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/app_mode/app_mode_utils.h" 9 #include "chrome/browser/app_mode/app_mode_utils.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 if (preferred_size_.width() == 0) 203 if (preferred_size_.width() == 0)
204 preferred_size_.set_width(kDefaultPanelWidth); 204 preferred_size_.set_width(kDefaultPanelWidth);
205 else if (preferred_size_.width() < kMinPanelWidth) 205 else if (preferred_size_.width() < kMinPanelWidth)
206 preferred_size_.set_width(kMinPanelWidth); 206 preferred_size_.set_width(kMinPanelWidth);
207 207
208 if (preferred_size_.height() == 0) 208 if (preferred_size_.height() == 0)
209 preferred_size_.set_height(kDefaultPanelHeight); 209 preferred_size_.set_height(kDefaultPanelHeight);
210 else if (preferred_size_.height() < kMinPanelHeight) 210 else if (preferred_size_.height() < kMinPanelHeight)
211 preferred_size_.set_height(kMinPanelHeight); 211 preferred_size_.set_height(kMinPanelHeight);
212 212
213 params.bounds = gfx::Rect(preferred_size_); 213 // When a panel is not docked |initial_window_bounds|'s origin is reset to
214 // |kUnspecifiedPosition| to trigger placing it in the currently active
215 // target root window.
216 typedef AppWindow::BoundsSpecification BoundsSpecification;
217 if (create_params.state != ui::SHOW_STATE_DOCKED) {
218 initial_window_bounds.set_origin(
219 gfx::Point(BoundsSpecification::kUnspecifiedPosition,
220 BoundsSpecification::kUnspecifiedPosition));
221 }
222 params.bounds = gfx::Rect(initial_window_bounds.origin(), preferred_size_);
214 OnBeforePanelWidgetInit(&params, widget()); 223 OnBeforePanelWidgetInit(&params, widget());
224 bool position_specified =
225 params.bounds.x() != BoundsSpecification::kUnspecifiedPosition &&
226 params.bounds.y() != BoundsSpecification::kUnspecifiedPosition;
227 if (!position_specified)
228 params.bounds = gfx::Rect(preferred_size_);
215 widget()->Init(params); 229 widget()->Init(params);
216 widget()->set_focus_on_creation(create_params.focused); 230 widget()->set_focus_on_creation(create_params.focused);
217 } 231 }
218 232
219 views::NonClientFrameView* 233 views::NonClientFrameView*
220 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() { 234 ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame() {
221 return views::WidgetDelegateView::CreateNonClientFrameView(widget()); 235 return views::WidgetDelegateView::CreateNonClientFrameView(widget());
222 } 236 }
223 237
224 apps::AppWindowFrameView* 238 apps::AppWindowFrameView*
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 InitializePanelWindow(create_params); 412 InitializePanelWindow(create_params);
399 } else { 413 } else {
400 InitializeDefaultWindow(create_params); 414 InitializeDefaultWindow(create_params);
401 } 415 }
402 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews( 416 extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
403 Profile::FromBrowserContext(app_window->browser_context()), 417 Profile::FromBrowserContext(app_window->browser_context()),
404 widget()->GetFocusManager(), 418 widget()->GetFocusManager(),
405 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, 419 extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
406 NULL)); 420 NULL));
407 } 421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698