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

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

Issue 133403003: Don't try to send automation message after the corresponding RV is gone (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ 5 #ifndef CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_
6 #define CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ 6 #define CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "content/public/renderer/render_view_observer.h"
9 #include "gin/wrappable.h" 10 #include "gin/wrappable.h"
10 11
11 /* DomAutomationController class: 12 /* DomAutomationController class:
12 Bound to Javascript window.domAutomationController object. 13 Bound to Javascript window.domAutomationController object.
13 At the very basic, this object makes any native value (string, numbers, 14 At the very basic, this object makes any native value (string, numbers,
14 boolean) from javascript available to the automation host in Cpp. 15 boolean) from javascript available to the automation host in Cpp.
15 Any renderer implementation that is built with this binding will allow the 16 Any renderer implementation that is built with this binding will allow the
16 above facility. 17 above facility.
17 The intended use of this object is to expose the DOM Objects and their 18 The intended use of this object is to expose the DOM Objects and their
18 attributes to the automation host. 19 attributes to the automation host.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 namespace blink { 74 namespace blink {
74 class WebFrame; 75 class WebFrame;
75 } 76 }
76 77
77 namespace gin { 78 namespace gin {
78 class Arguments; 79 class Arguments;
79 } 80 }
80 81
81 namespace content { 82 namespace content {
82 83
83 class DomAutomationController : public gin::Wrappable<DomAutomationController> { 84 class RenderViewImpl;
85
86 class DomAutomationController : public gin::Wrappable<DomAutomationController>,
87 public RenderViewObserver {
84 public: 88 public:
85 static gin::WrapperInfo kWrapperInfo; 89 static gin::WrapperInfo kWrapperInfo;
86 90
87 static void Install(blink::WebFrame* frame); 91 static void Install(RenderViewImpl* render_view, blink::WebFrame* frame);
88 92
89 // Makes the renderer send a javascript value to the app. 93 // Makes the renderer send a javascript value to the app.
90 // The value to be sent can be either of type String, 94 // The value to be sent can be either of type String,
91 // Number (double casted to int32) or Boolean. Any other type or no 95 // Number (double casted to int32) or Boolean. Any other type or no
92 // argument at all is ignored. 96 // argument at all is ignored.
93 bool Send(const gin::Arguments& args); 97 bool SendMsg(const gin::Arguments& args);
94 98
95 // Makes the renderer send a javascript value to the app. 99 // Makes the renderer send a javascript value to the app.
96 // The value should be properly formed JSON. 100 // The value should be properly formed JSON.
97 bool SendJSON(const std::string& json); 101 bool SendJSON(const std::string& json);
98 102
99 // Sends a string with a provided Automation Id. 103 // Sends a string with a provided Automation Id.
100 bool SendWithId(int automation_id, const std::string& str); 104 bool SendWithId(int automation_id, const std::string& str);
101 105
102 bool SetAutomationId(int automation_id); 106 bool SetAutomationId(int automation_id);
103 107
104 private: 108 private:
105 explicit DomAutomationController(blink::WebFrame* frame); 109 explicit DomAutomationController(RenderViewImpl* render_view);
106 virtual ~DomAutomationController(); 110 virtual ~DomAutomationController();
107 111
108 // gin::WrappableBase 112 // gin::WrappableBase
109 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( 113 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
110 v8::Isolate* isolate) OVERRIDE; 114 v8::Isolate* isolate) OVERRIDE;
111 115
112 blink::WebFrame* frame_; 116 // RenderViewObserver
117 virtual void OnDestruct() OVERRIDE;
113 118
114 int automation_id_; // routing id to be used by the next channel. 119 int automation_id_; // routing id to be used by the next channel.
115 120
116 DISALLOW_COPY_AND_ASSIGN(DomAutomationController); 121 DISALLOW_COPY_AND_ASSIGN(DomAutomationController);
117 }; 122 };
118 123
119 } // namespace content 124 } // namespace content
120 125
121 #endif // CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ 126 #endif // CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/dom_automation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698