| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/browser/automation/automation_provider_list.h" | 9 #include "chrome/browser/automation/automation_provider_list.h" |
| 10 #include "chrome/browser/automation/ui_controls.h" | 10 #include "chrome/browser/automation/ui_controls.h" |
| (...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 if (web_contents) { | 1584 if (web_contents) { |
| 1585 // Set the routing id of this message with the controller. | 1585 // Set the routing id of this message with the controller. |
| 1586 // This routing id needs to be remembered for the reverse | 1586 // This routing id needs to be remembered for the reverse |
| 1587 // communication while sending back the response of | 1587 // communication while sending back the response of |
| 1588 // this javascript execution. | 1588 // this javascript execution. |
| 1589 std::wstring url; | 1589 std::wstring url; |
| 1590 SStringPrintf(&url, | 1590 SStringPrintf(&url, |
| 1591 L"javascript:void(window.domAutomationController.setAutomationId(%d));", | 1591 L"javascript:void(window.domAutomationController.setAutomationId(%d));", |
| 1592 message.routing_id()); | 1592 message.routing_id()); |
| 1593 | 1593 |
| 1594 web_contents->ExecuteJavascriptInWebFrame(frame_xpath, url); | 1594 web_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
| 1595 web_contents->ExecuteJavascriptInWebFrame(frame_xpath, script); | 1595 frame_xpath, url); |
| 1596 web_contents->render_view_host()->ExecuteJavascriptInWebFrame( |
| 1597 frame_xpath, script); |
| 1596 succeeded = true; | 1598 succeeded = true; |
| 1597 } | 1599 } |
| 1598 | 1600 |
| 1599 if (!succeeded) { | 1601 if (!succeeded) { |
| 1600 Send(new AutomationMsg_DomOperationResponse(message.routing_id(), "")); | 1602 Send(new AutomationMsg_DomOperationResponse(message.routing_id(), "")); |
| 1601 } | 1603 } |
| 1602 } | 1604 } |
| 1603 | 1605 |
| 1604 void AutomationProvider::GetShelfVisibility(const IPC::Message& message, | 1606 void AutomationProvider::GetShelfVisibility(const IPC::Message& message, |
| 1605 int handle) { | 1607 int handle) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 } | 1763 } |
| 1762 | 1764 |
| 1763 Send(new AutomationMsg_BookmarkBarVisibilityResponse(message.routing_id(), | 1765 Send(new AutomationMsg_BookmarkBarVisibilityResponse(message.routing_id(), |
| 1764 visible, animating)); | 1766 visible, animating)); |
| 1765 } | 1767 } |
| 1766 | 1768 |
| 1767 void AutomationProvider::HandleInspectElementRequest( | 1769 void AutomationProvider::HandleInspectElementRequest( |
| 1768 const IPC::Message& message, int handle, int x, int y) { | 1770 const IPC::Message& message, int handle, int x, int y) { |
| 1769 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); | 1771 WebContents* web_contents = GetWebContentsForHandle(handle, NULL); |
| 1770 if (web_contents) { | 1772 if (web_contents) { |
| 1771 web_contents->InspectElementAt(x, y); | 1773 web_contents->render_view_host()->InspectElementAt(x, y); |
| 1772 inspect_element_routing_id_ = message.routing_id(); | 1774 inspect_element_routing_id_ = message.routing_id(); |
| 1773 } else { | 1775 } else { |
| 1774 Send(new AutomationMsg_InspectElementResponse(message.routing_id(), -1)); | 1776 Send(new AutomationMsg_InspectElementResponse(message.routing_id(), -1)); |
| 1775 } | 1777 } |
| 1776 } | 1778 } |
| 1777 | 1779 |
| 1778 void AutomationProvider::ReceivedInspectElementResponse(int num_resources) { | 1780 void AutomationProvider::ReceivedInspectElementResponse(int num_resources) { |
| 1779 Send(new AutomationMsg_InspectElementResponse(inspect_element_routing_id_, | 1781 Send(new AutomationMsg_InspectElementResponse(inspect_element_routing_id_, |
| 1780 num_resources)); | 1782 num_resources)); |
| 1781 } | 1783 } |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2396 int value) { | 2398 int value) { |
| 2397 bool success = false; | 2399 bool success = false; |
| 2398 if (browser_tracker_->ContainsHandle(handle)) { | 2400 if (browser_tracker_->ContainsHandle(handle)) { |
| 2399 Browser* browser = browser_tracker_->GetResource(handle); | 2401 Browser* browser = browser_tracker_->GetResource(handle); |
| 2400 browser->profile()->GetPrefs()->SetInteger(name.c_str(), value); | 2402 browser->profile()->GetPrefs()->SetInteger(name.c_str(), value); |
| 2401 success = true; | 2403 success = true; |
| 2402 } | 2404 } |
| 2403 Send(new AutomationMsg_SetIntPreferenceResponse(message.routing_id(), | 2405 Send(new AutomationMsg_SetIntPreferenceResponse(message.routing_id(), |
| 2404 success)); | 2406 success)); |
| 2405 } | 2407 } |
| OLD | NEW |