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

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10388251: Support maximize window command. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Since the python bindings are to a newer version now, update chromedriver_tests.py accordingly." Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/testing_automation_provider.cc
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index c74a6eb2bd140149bc2fbd825dda7ccae92cb34e..2bad87ea2db2bff8b6b3059acc55ec0a67f3945b 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -1700,6 +1700,8 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
&TestingAutomationProvider::CloseTabJSON;
handler_map["SetViewBounds"] =
&TestingAutomationProvider::SetViewBounds;
+ handler_map["MaximizeView"] =
+ &TestingAutomationProvider::MaximizeView;
handler_map["WebkitMouseMove"] =
&TestingAutomationProvider::WebkitMouseMove;
handler_map["WebkitMouseClick"] =
@@ -6501,10 +6503,39 @@ void TestingAutomationProvider::SetViewBounds(
reply.SendError(Error(automation::kInvalidId, error));
return;
}
- browser->window()->SetBounds(gfx::Rect(x, y, width, height));
+ BrowserWindow* browser_window = browser->window();
+ if (browser_window->IsMaximized()) {
+ browser_window->Restore();
+ }
+ browser_window->SetBounds(gfx::Rect(x, y, width, height));
reply.SendSuccess(NULL);
}
+void TestingAutomationProvider::MaximizeView(
+ base::DictionaryValue* args,
+ IPC::Message* reply_message) {
+ Browser* browser;
+ std::string error;
+ if (!GetBrowserFromJSONArgs(args, &browser, &error)) {
+ AutomationJSONReply(this, reply_message)
+ .SendError(Error(automation::kInvalidId, error));
+ return;
+ }
+
+#if defined(OS_LINUX)
+ // Maximization on Linux is asynchronous, so create an observer object to be
+ // notified upon maximization completion.
+ new WindowMaximizedObserver(this, reply_message);
+#endif // defined(OS_LINUX)
+
+ browser->window()->Maximize();
+
+#if !defined(OS_LINUX)
+ // Send success reply right away for OS's with synchronous maximize command.
+ AutomationJSONReply(this, reply_message).SendSuccess(NULL);
+#endif // !defined(OS_LINUX)
+}
+
void TestingAutomationProvider::ActivateTabJSON(
DictionaryValue* args,
IPC::Message* reply_message) {
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/ui/gtk/browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698