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

Side by Side Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 25449002: Add chrome.app.window.[get|set][Min|Max][Width|Height] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/app_window/app_window_api.h" 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h"
6 6
7 #include "apps/app_window_contents.h" 7 #include "apps/app_window_contents.h"
8 #include "apps/shell_window.h" 8 #include "apps/shell_window.h"
9 #include "apps/shell_window_registry.h" 9 #include "apps/shell_window_registry.h"
10 #include "apps/ui/native_app_window.h" 10 #include "apps/ui/native_app_window.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 result->SetBoolean("minimized", window->GetBaseWindow()->IsMinimized()); 94 result->SetBoolean("minimized", window->GetBaseWindow()->IsMinimized());
95 result->SetBoolean("maximized", window->GetBaseWindow()->IsMaximized()); 95 result->SetBoolean("maximized", window->GetBaseWindow()->IsMaximized());
96 result->SetBoolean("alwaysOnTop", window->GetBaseWindow()->IsAlwaysOnTop()); 96 result->SetBoolean("alwaysOnTop", window->GetBaseWindow()->IsAlwaysOnTop());
97 base::DictionaryValue* boundsValue = new base::DictionaryValue(); 97 base::DictionaryValue* boundsValue = new base::DictionaryValue();
98 gfx::Rect bounds = window->GetClientBounds(); 98 gfx::Rect bounds = window->GetClientBounds();
99 boundsValue->SetInteger("left", bounds.x()); 99 boundsValue->SetInteger("left", bounds.x());
100 boundsValue->SetInteger("top", bounds.y()); 100 boundsValue->SetInteger("top", bounds.y());
101 boundsValue->SetInteger("width", bounds.width()); 101 boundsValue->SetInteger("width", bounds.width());
102 boundsValue->SetInteger("height", bounds.height()); 102 boundsValue->SetInteger("height", bounds.height());
103 result->Set("bounds", boundsValue); 103 result->Set("bounds", boundsValue);
104
105 const ShellWindow::SizeConstraints& size_constraints =
106 window->size_constraints();
107 gfx::Size min_size = size_constraints.GetMinimumSize();
108 gfx::Size max_size = size_constraints.GetMaximumSize();
109 result->SetInteger("minWidth", min_size.width());
110 result->SetInteger("minHeight", min_size.height());
111 result->SetInteger("maxWidth", max_size.width());
112 result->SetInteger("maxHeight", max_size.height());
104 } 113 }
105 114
106 } // namespace 115 } // namespace
107 116
108 void AppWindowCreateFunction::SendDelayedResponse() { 117 void AppWindowCreateFunction::SendDelayedResponse() {
109 SendResponse(true); 118 SendResponse(true);
110 } 119 }
111 120
112 bool AppWindowCreateFunction::RunImpl() { 121 bool AppWindowCreateFunction::RunImpl() {
113 // Don't create app window if the system is shutting down. 122 // Don't create app window if the system is shutting down.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 HadDevToolsAttached(created_view)) { 310 HadDevToolsAttached(created_view)) {
302 new DevToolsRestorer(this, created_view); 311 new DevToolsRestorer(this, created_view);
303 return true; 312 return true;
304 } 313 }
305 314
306 SendResponse(true); 315 SendResponse(true);
307 return true; 316 return true;
308 } 317 }
309 318
310 } // namespace extensions 319 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698