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 #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> |
| 10 #include <vector> |
| 11 |
9 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
| 13 #include "content/public/renderer/render_view_observer_tracker.h" |
10 | 14 |
11 namespace WebKit { | 15 namespace WebKit { |
12 class WebFrame; | 16 class WebFrame; |
13 class WebURL; | 17 class WebURL; |
| 18 class WebView; |
14 } | 19 } |
15 | 20 |
16 // Filters automation/testing messages sent to a |RenderView| and sends | 21 // Filters automation/testing messages sent to a |RenderView| and sends |
17 // automation/testing messages to the browser. | 22 // automation/testing messages to the browser. |
18 class AutomationRendererHelper : public content::RenderViewObserver { | 23 class AutomationRendererHelper |
| 24 : public content::RenderViewObserver, |
| 25 public content::RenderViewObserverTracker<AutomationRendererHelper> { |
19 public: | 26 public: |
20 explicit AutomationRendererHelper(content::RenderView* render_view); | 27 explicit AutomationRendererHelper(content::RenderView* render_view); |
21 virtual ~AutomationRendererHelper(); | 28 virtual ~AutomationRendererHelper(); |
22 | 29 |
| 30 // Takes a snapshot of the entire page without changing layout size. |
| 31 bool SnapshotEntirePage(WebKit::WebView* view, |
| 32 std::vector<unsigned char>* png_data, |
| 33 std::string* error_msg); |
| 34 |
23 private: | 35 private: |
| 36 void OnSnapshotEntirePage(); |
| 37 |
24 // RenderViewObserver implementation. | 38 // RenderViewObserver implementation. |
| 39 virtual bool OnMessageReceived(const IPC::Message& message); |
25 virtual void WillPerformClientRedirect( | 40 virtual void WillPerformClientRedirect( |
26 WebKit::WebFrame* frame, const WebKit::WebURL& from, | 41 WebKit::WebFrame* frame, const WebKit::WebURL& from, |
27 const WebKit::WebURL& to, double interval, double fire_time); | 42 const WebKit::WebURL& to, double interval, double fire_time); |
28 virtual void DidCancelClientRedirect(WebKit::WebFrame* frame); | 43 virtual void DidCancelClientRedirect(WebKit::WebFrame* frame); |
29 virtual void DidCompleteClientRedirect(WebKit::WebFrame* frame, | 44 virtual void DidCompleteClientRedirect(WebKit::WebFrame* frame, |
30 const WebKit::WebURL& from); | 45 const WebKit::WebURL& from); |
31 | 46 |
32 DISALLOW_COPY_AND_ASSIGN(AutomationRendererHelper); | 47 DISALLOW_COPY_AND_ASSIGN(AutomationRendererHelper); |
33 }; | 48 }; |
34 | 49 |
35 #endif // CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_ | 50 #endif // CHROME_RENDERER_AUTOMATION_AUTOMATION_RENDERER_HELPER_H_ |
OLD | NEW |