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

Side by Side Diff: chrome/renderer/automation/automation_renderer_helper.h

Issue 10384023: Determine the element location and click synchronously on the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
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 CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_ 5 #ifndef CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_
6 #define CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_ 6 #define CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h"
12 #include "content/public/renderer/render_view_observer.h" 13 #include "content/public/renderer/render_view_observer.h"
13 #include "content/public/renderer/render_view_observer_tracker.h" 14 #include "content/public/renderer/render_view_observer_tracker.h"
14 15
16 namespace base {
17 class DictionaryValue;
18 }
19
15 namespace WebKit { 20 namespace WebKit {
16 class WebFrame; 21 class WebFrame;
17 class WebURL; 22 class WebURL;
18 class WebView; 23 class WebView;
19 } 24 }
20 25
26 struct AutomationMouseEvent;
27 struct ScriptEvaluationRequest;
28
21 // Filters automation/testing messages sent to a |RenderView| and sends 29 // Filters automation/testing messages sent to a |RenderView| and sends
22 // automation/testing messages to the browser. 30 // automation/testing messages to the browser.
23 class AutomationRendererHelper : public content::RenderViewObserver { 31 class AutomationRendererHelper : public content::RenderViewObserver {
24 public: 32 public:
25 explicit AutomationRendererHelper(content::RenderView* render_view); 33 explicit AutomationRendererHelper(content::RenderView* render_view);
26 virtual ~AutomationRendererHelper(); 34 virtual ~AutomationRendererHelper();
27 35
28 // Takes a snapshot of the entire page without changing layout size. 36 // Takes a snapshot of the entire page without changing layout size.
29 bool SnapshotEntirePage(WebKit::WebView* view, 37 bool SnapshotEntirePage(WebKit::WebView* view,
30 std::vector<unsigned char>* png_data, 38 std::vector<unsigned char>* png_data,
31 std::string* error_msg); 39 std::string* error_msg);
32 40
41 // Evaluates a list of scripts. Each script must result in exactly
42 // one JavaScript object, which is passed to the next script as input.
43 // The final output is returned in |result|. If any JavaScript object
44 // contains an 'error' key, |error_msg| will be set to the corresponding
45 // value and the method will return false. If any script throws an exception,
46 // this method will return false with an appropriate error message.
47 // |script_chain| must not be empty.
48 bool EvaluateScriptChain(
49 const std::vector<ScriptEvaluationRequest>& script_chain,
50 scoped_ptr<base::DictionaryValue>* result,
51 std::string* error_msg);
52
53 // Processes the given event. On error, returns false and sets |error_msg|.
54 bool ProcessMouseEvent(const AutomationMouseEvent& event,
55 std::string* error_msg);
56
33 private: 57 private:
34 void OnSnapshotEntirePage(); 58 void OnSnapshotEntirePage();
35 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS)) 59 #if !defined(NO_TCMALLOC) && (defined(OS_LINUX) || defined(OS_CHROMEOS))
36 void OnHeapProfilerDump(const std::string& reason); 60 void OnHeapProfilerDump(const std::string& reason);
37 #endif 61 #endif
38 62
39 // RenderViewObserver implementation. 63 // RenderViewObserver implementation.
40 virtual bool OnMessageReceived(const IPC::Message& message); 64 virtual bool OnMessageReceived(const IPC::Message& message);
41 virtual void WillPerformClientRedirect( 65 virtual void WillPerformClientRedirect(
42 WebKit::WebFrame* frame, const WebKit::WebURL& from, 66 WebKit::WebFrame* frame, const WebKit::WebURL& from,
43 const WebKit::WebURL& to, double interval, double fire_time); 67 const WebKit::WebURL& to, double interval, double fire_time);
44 virtual void DidCancelClientRedirect(WebKit::WebFrame* frame); 68 virtual void DidCancelClientRedirect(WebKit::WebFrame* frame);
45 virtual void DidCompleteClientRedirect(WebKit::WebFrame* frame, 69 virtual void DidCompleteClientRedirect(WebKit::WebFrame* frame,
46 const WebKit::WebURL& from); 70 const WebKit::WebURL& from);
71 virtual void OnProcessMouseEvent(const AutomationMouseEvent& event);
47 72
48 DISALLOW_COPY_AND_ASSIGN(AutomationRendererHelper); 73 DISALLOW_COPY_AND_ASSIGN(AutomationRendererHelper);
49 }; 74 };
50 75
51 #endif // CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_ 76 #endif // CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/common/automation_messages_internal.h ('k') | chrome/renderer/automation/automation_renderer_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698