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

Unified Diff: chrome/browser/ui/extensions/shell_window.cc

Issue 11369039: Add setBounds method and browsertest for get/set bounds to app window API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/extensions/shell_window.cc
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index a91e66690a7f73905b29531c802ba704f6ed1ff8..175b1be01f41ca597fb418634d786f8cfe93b8b4 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -450,8 +450,28 @@ void ShellWindow::AddMessageToDevToolsConsole(ConsoleMessageLevel level,
rvh->GetRoutingID(), level, message));
}
-void ShellWindow::SaveWindowPosition()
-{
+void ShellWindow::SendBoundsUpdate() {
+ if (!native_window_ || !web_contents_)
+ return;
+ gfx::Rect bounds = native_window_->GetBounds();
+ content::RenderViewHost* rvh = web_contents_->GetRenderViewHost();
+ ListValue args;
+ DictionaryValue* update = new DictionaryValue();
+ args.Append(update);
+ update->SetInteger("left", bounds.x());
+ update->SetInteger("top", bounds.y());
+ update->SetInteger("width", bounds.width());
+ update->SetInteger("height", bounds.height());
+ rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(),
+ extension_->id(),
+ "updateAppWindowBounds",
+ args,
+ GURL(),
+ false));
+}
+
+void ShellWindow::SaveWindowPosition() {
+ SendBoundsUpdate();
if (window_key_.empty())
return;

Powered by Google App Engine
This is Rietveld 408576698