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

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: Unit test in chromedriver_tests.py; nicer error reporting - a method to check whether the current v… Created 8 years, 7 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 fe1acbd7ecf94da4e95ea1f9e382dfd6790085f6..7dfbbfc259a9258b86df09abf60dd82c109dc8bd 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -1698,6 +1698,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"] =
@@ -6498,7 +6500,25 @@ 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) {
+ AutomationJSONReply reply(this, reply_message);
+ Browser* browser;
+ std::string error;
+ if (!GetBrowserFromJSONArgs(args, &browser, &error)) {
+ reply.SendError(Error(automation::kInvalidId, error));
+ return;
+ }
+ browser->window()->Maximize();
kkania 2012/05/24 17:25:38 in thinking this over, I would prefer we go ahead
zori 2012/05/29 23:53:32 Done.
reply.SendSuccess(NULL);
}

Powered by Google App Engine
This is Rietveld 408576698