OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 | 1249 |
1250 // Set the routing id of this message with the controller. | 1250 // Set the routing id of this message with the controller. |
1251 // This routing id needs to be remembered for the reverse | 1251 // This routing id needs to be remembered for the reverse |
1252 // communication while sending back the response of | 1252 // communication while sending back the response of |
1253 // this javascript execution. | 1253 // this javascript execution. |
1254 std::string set_automation_id; | 1254 std::string set_automation_id; |
1255 base::SStringPrintf(&set_automation_id, | 1255 base::SStringPrintf(&set_automation_id, |
1256 "window.domAutomationController.setAutomationId(%d);", | 1256 "window.domAutomationController.setAutomationId(%d);", |
1257 reply_message->routing_id()); | 1257 reply_message->routing_id()); |
1258 | 1258 |
1259 DCHECK(!reply_message_); | 1259 new DomOperationMessageSender(this, reply_message, false); |
1260 reply_message_ = reply_message; | |
1261 | |
1262 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 1260 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
1263 WideToUTF16Hack(frame_xpath), UTF8ToUTF16(set_automation_id)); | 1261 WideToUTF16Hack(frame_xpath), UTF8ToUTF16(set_automation_id)); |
1264 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 1262 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
1265 WideToUTF16Hack(frame_xpath), WideToUTF16Hack(script)); | 1263 WideToUTF16Hack(frame_xpath), WideToUTF16Hack(script)); |
1266 } | 1264 } |
1267 | 1265 |
1268 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, | 1266 void TestingAutomationProvider::GetConstrainedWindowCount(int handle, |
1269 int* count) { | 1267 int* count) { |
1270 *count = -1; // -1 is the error code | 1268 *count = -1; // -1 is the error code |
1271 if (tab_tracker_->ContainsHandle(handle)) { | 1269 if (tab_tracker_->ContainsHandle(handle)) { |
(...skipping 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4914 | 4912 |
4915 // Set the routing id of this message with the controller. | 4913 // Set the routing id of this message with the controller. |
4916 // This routing id needs to be remembered for the reverse | 4914 // This routing id needs to be remembered for the reverse |
4917 // communication while sending back the response of | 4915 // communication while sending back the response of |
4918 // this javascript execution. | 4916 // this javascript execution. |
4919 std::string set_automation_id; | 4917 std::string set_automation_id; |
4920 base::SStringPrintf(&set_automation_id, | 4918 base::SStringPrintf(&set_automation_id, |
4921 "window.domAutomationController.setAutomationId(%d);", | 4919 "window.domAutomationController.setAutomationId(%d);", |
4922 reply_message->routing_id()); | 4920 reply_message->routing_id()); |
4923 | 4921 |
4924 new ExecuteJavascriptObserver(this, reply_message); | 4922 new DomOperationMessageSender(this, reply_message, true); |
4925 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 4923 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
4926 frame_xpath, UTF8ToUTF16(set_automation_id)); | 4924 frame_xpath, UTF8ToUTF16(set_automation_id)); |
4927 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | 4925 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
4928 frame_xpath, javascript); | 4926 frame_xpath, javascript); |
4929 } | 4927 } |
4930 | 4928 |
4931 void TestingAutomationProvider::GoForward( | 4929 void TestingAutomationProvider::GoForward( |
4932 DictionaryValue* args, | 4930 DictionaryValue* args, |
4933 IPC::Message* reply_message) { | 4931 IPC::Message* reply_message) { |
4934 TabContents* tab_contents; | 4932 TabContents* tab_contents; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5358 // If you change this, update Observer for NotificationType::SESSION_END | 5356 // If you change this, update Observer for NotificationType::SESSION_END |
5359 // below. | 5357 // below. |
5360 MessageLoop::current()->PostTask(FROM_HERE, | 5358 MessageLoop::current()->PostTask(FROM_HERE, |
5361 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 5359 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
5362 } | 5360 } |
5363 } | 5361 } |
5364 | 5362 |
5365 void TestingAutomationProvider::OnRemoveProvider() { | 5363 void TestingAutomationProvider::OnRemoveProvider() { |
5366 AutomationProviderList::GetInstance()->RemoveProvider(this); | 5364 AutomationProviderList::GetInstance()->RemoveProvider(this); |
5367 } | 5365 } |
OLD | NEW |