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

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

Issue 11193049: Add the app.windows.getBounds method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased against head 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 a3fefd4068a8be43af9381302a85fe9edfcadb8f..3104128748e22b600a3ee04c3672fb88095d29fc 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -27,6 +27,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/view_type_utils.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/extensions/api/app_window.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/request_media_access_permission_helper.h"
@@ -47,6 +48,8 @@
#include "content/public/common/renderer_preferences.h"
#include "third_party/skia/include/core/SkRegion.h"
+namespace app_window = extensions::api::app_window;
+
using content::BrowserThread;
using content::ConsoleMessageLevel;
using content::RenderViewHost;
@@ -462,8 +465,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;
+ app_window::Bounds update;
+ update.left.reset(new int(bounds.x()));
+ update.top.reset(new int(bounds.y()));
+ update.width.reset(new int(bounds.width()));
+ update.height.reset(new int(bounds.height()));
+ args.Append(update.ToValue().release());
+ rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(),
+ extension_->id(),
+ "updateAppWindowBounds",
+ args,
+ GURL(),
+ false));
+}
+
+void ShellWindow::SaveWindowPosition() {
+ SendBoundsUpdate();
if (window_key_.empty())
return;
if (!native_window_)
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.h ('k') | chrome/browser/ui/views/extensions/shell_window_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698