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

Side by Side Diff: content/renderer/dom_automation_controller.cc

Issue 2503453003: Remove all calls to domAutomationController.setAutomationId.
Patch Set: Fix nacl_browsertest_util.cc Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/dom_automation_controller.h" 5 #include "content/renderer/dom_automation_controller.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/child/v8_value_converter_impl.h" 9 #include "content/child/v8_value_converter_impl.h"
10 #include "content/common/child_process_messages.h" 10 #include "content/common/child_process_messages.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 DomAutomationController::DomAutomationController(RenderFrame* render_frame) 44 DomAutomationController::DomAutomationController(RenderFrame* render_frame)
45 : RenderFrameObserver(render_frame) {} 45 : RenderFrameObserver(render_frame) {}
46 46
47 DomAutomationController::~DomAutomationController() {} 47 DomAutomationController::~DomAutomationController() {}
48 48
49 gin::ObjectTemplateBuilder DomAutomationController::GetObjectTemplateBuilder( 49 gin::ObjectTemplateBuilder DomAutomationController::GetObjectTemplateBuilder(
50 v8::Isolate* isolate) { 50 v8::Isolate* isolate) {
51 return gin::Wrappable<DomAutomationController>::GetObjectTemplateBuilder( 51 return gin::Wrappable<DomAutomationController>::GetObjectTemplateBuilder(
52 isolate) 52 isolate)
53 .SetMethod("send", &DomAutomationController::SendMsg) 53 .SetMethod("send", &DomAutomationController::SendMsg)
54 .SetMethod("setAutomationId", &DomAutomationController::SetAutomationId) 54 .SetMethod("sendJSON", &DomAutomationController::SendJSON);
55 .SetMethod("sendJSON", &DomAutomationController::SendJSON)
56 .SetMethod("sendWithId", &DomAutomationController::SendWithId);
57 } 55 }
58 56
59 void DomAutomationController::OnDestruct() {} 57 void DomAutomationController::OnDestruct() {}
60 58
61 void DomAutomationController::DidCreateScriptContext( 59 void DomAutomationController::DidCreateScriptContext(
62 v8::Local<v8::Context> context, 60 v8::Local<v8::Context> context,
63 int world_id) { 61 int world_id) {
64 // Add the domAutomationController to isolated worlds as well. 62 // Add the domAutomationController to isolated worlds as well.
65 v8::Isolate* isolate = blink::MainThreadIsolate(); 63 v8::Isolate* isolate = blink::MainThreadIsolate();
66 v8::HandleScope handle_scope(isolate); 64 v8::HandleScope handle_scope(isolate);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 value = 97 value =
100 conv.FromV8Value(args.PeekNext(), args.isolate()->GetCurrentContext()); 98 conv.FromV8Value(args.PeekNext(), args.isolate()->GetCurrentContext());
101 } else { 99 } else {
102 NOTREACHED() << "No arguments passed to domAutomationController.send"; 100 NOTREACHED() << "No arguments passed to domAutomationController.send";
103 return false; 101 return false;
104 } 102 }
105 103
106 if (!value || !serializer.Serialize(*value)) 104 if (!value || !serializer.Serialize(*value))
107 return false; 105 return false;
108 106
109 bool succeeded = Send(new FrameHostMsg_DomOperationResponse( 107 return SendJSON(json);
110 routing_id(), json));
111
112 return succeeded;
113 } 108 }
114 109
115 bool DomAutomationController::SendJSON(const std::string& json) { 110 bool DomAutomationController::SendJSON(const std::string& json) {
116 if (!render_frame()) 111 if (!render_frame())
117 return false; 112 return false;
118 113
119 bool result = Send(new FrameHostMsg_DomOperationResponse( 114 bool result = Send(new FrameHostMsg_DomOperationResponse(
120 routing_id(), json)); 115 routing_id(), json));
121 116
122 return result; 117 return result;
123 } 118 }
124 119
125 bool DomAutomationController::SendWithId(int automation_id,
126 const std::string& str) {
127 if (!render_frame())
128 return false;
129 return Send(
130 new FrameHostMsg_DomOperationResponse(routing_id(), str));
131 }
132
133 bool DomAutomationController::SetAutomationId(int automation_id) {
134 return true;
135 }
136
137 } // namespace content 120 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/dom_automation_controller.h ('k') | content/test/data/cross_site_document_request.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698