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

Side by Side Diff: apps/app_window_contents.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/app_window_contents.h" 5 #include "apps/app_window_contents.h"
6 6
7 #include "apps/native_app_window.h" 7 #include "apps/native_app_window.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/api/app_window.h" 10 #include "chrome/common/extensions/api/app_window.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 update.left.reset(new int(bounds.x())); 86 update.left.reset(new int(bounds.x()));
87 update.top.reset(new int(bounds.y())); 87 update.top.reset(new int(bounds.y()));
88 update.width.reset(new int(bounds.width())); 88 update.width.reset(new int(bounds.width()));
89 update.height.reset(new int(bounds.height())); 89 update.height.reset(new int(bounds.height()));
90 dictionary->Set("bounds", update.ToValue().release()); 90 dictionary->Set("bounds", update.ToValue().release());
91 dictionary->SetBoolean("fullscreen", 91 dictionary->SetBoolean("fullscreen",
92 native_app_window->IsFullscreenOrPending()); 92 native_app_window->IsFullscreenOrPending());
93 dictionary->SetBoolean("minimized", native_app_window->IsMinimized()); 93 dictionary->SetBoolean("minimized", native_app_window->IsMinimized());
94 dictionary->SetBoolean("maximized", native_app_window->IsMaximized()); 94 dictionary->SetBoolean("maximized", native_app_window->IsMaximized());
95 95
96 const ShellWindow::SizeConstraints& size_constraints =
97 host_->size_constraints();
98 gfx::Size min_size = size_constraints.GetMinimumSize();
99 gfx::Size max_size = size_constraints.GetMaximumSize();
100 dictionary->SetInteger("minWidth", min_size.width());
101 dictionary->SetInteger("minHeight", min_size.height());
102 dictionary->SetInteger("maxWidth", max_size.width());
103 dictionary->SetInteger("maxHeight", max_size.height());
104
96 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); 105 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
97 rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(), 106 rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(),
98 host_->extension_id(), 107 host_->extension_id(),
99 "app.window", 108 "app.window",
100 "updateAppWindowProperties", 109 "updateAppWindowProperties",
101 args, 110 args,
102 false)); 111 false));
103 } 112 }
104 113
105 void AppWindowContents::NativeWindowClosed() { 114 void AppWindowContents::NativeWindowClosed() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 content::RenderViewHost* rvh) { 176 content::RenderViewHost* rvh) {
168 DCHECK(rvh); 177 DCHECK(rvh);
169 content::BrowserThread::PostTask( 178 content::BrowserThread::PostTask(
170 content::BrowserThread::IO, FROM_HERE, 179 content::BrowserThread::IO, FROM_HERE,
171 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, 180 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute,
172 base::Unretained(content::ResourceDispatcherHost::Get()), 181 base::Unretained(content::ResourceDispatcherHost::Get()),
173 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); 182 rvh->GetProcess()->GetID(), rvh->GetRoutingID()));
174 } 183 }
175 184
176 } // namespace apps 185 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698