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