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

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: Rebase. Use ShellWindow::Set[Min|Max]imumSize. Update tests. 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/native_app_window.h" 8 #include "apps/native_app_window.h"
9 #include "apps/shell_window.h" 9 #include "apps/shell_window.h"
10 #include "apps/shell_window_registry.h" 10 #include "apps/shell_window_registry.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 result->SetBoolean("fullscreen", window->GetBaseWindow()->IsFullscreen()); 93 result->SetBoolean("fullscreen", window->GetBaseWindow()->IsFullscreen());
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 base::DictionaryValue* boundsValue = new base::DictionaryValue(); 96 base::DictionaryValue* boundsValue = new base::DictionaryValue();
97 gfx::Rect bounds = window->GetClientBounds(); 97 gfx::Rect bounds = window->GetClientBounds();
98 boundsValue->SetInteger("left", bounds.x()); 98 boundsValue->SetInteger("left", bounds.x());
99 boundsValue->SetInteger("top", bounds.y()); 99 boundsValue->SetInteger("top", bounds.y());
100 boundsValue->SetInteger("width", bounds.width()); 100 boundsValue->SetInteger("width", bounds.width());
101 boundsValue->SetInteger("height", bounds.height()); 101 boundsValue->SetInteger("height", bounds.height());
102 result->Set("bounds", boundsValue); 102 result->Set("bounds", boundsValue);
103
104 const ShellWindow::SizeConstraints& size_constraints =
tapted 2013/10/16 23:31:52 Hm. this is identical to the code in AppWindowCont
105 window->size_constraints();
106 gfx::Size min_size = size_constraints.GetMinimumSize();
107 gfx::Size max_size = size_constraints.GetMaximumSize();
108 result->SetInteger("minWidth", min_size.width());
109 result->SetInteger("minHeight", min_size.height());
110 result->SetInteger("maxWidth", max_size.width());
111 result->SetInteger("maxHeight", max_size.height());
103 } 112 }
104 113
105 } // namespace 114 } // namespace
106 115
107 void AppWindowCreateFunction::SendDelayedResponse() { 116 void AppWindowCreateFunction::SendDelayedResponse() {
108 SendResponse(true); 117 SendResponse(true);
109 } 118 }
110 119
111 bool AppWindowCreateFunction::RunImpl() { 120 bool AppWindowCreateFunction::RunImpl() {
112 // Don't create app window if the system is shutting down. 121 // Don't create app window if the system is shutting down.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 HadDevToolsAttached(created_view)) { 302 HadDevToolsAttached(created_view)) {
294 new DevToolsRestorer(this, created_view); 303 new DevToolsRestorer(this, created_view);
295 return true; 304 return true;
296 } 305 }
297 306
298 SendResponse(true); 307 SendResponse(true);
299 return true; 308 return true;
300 } 309 }
301 310
302 } // namespace extensions 311 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698