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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.h

Issue 6874038: Remove the last Chrome dependencies from renderer, and enforce no more includes through DEPS. I ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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) 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_CHROME_RENDER_VIEW_OBSERVER_H_ 5 #ifndef CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
6 #define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ 6 #define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector>
10
9 #include "base/task.h" 11 #include "base/task.h"
12 #include "base/scoped_ptr.h"
13 #include "content/renderer/render_view.h"
10 #include "content/renderer/render_view_observer.h" 14 #include "content/renderer/render_view_observer.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPageSerializerClie nt.h"
11 16
17 class DomAutomationController;
18 class ExternalHostBindings;
19 class FilePath;
20 class GURL;
12 class SkBitmap; 21 class SkBitmap;
13 class TranslateHelper; 22 class TranslateHelper;
14 struct ThumbnailScore; 23 struct ThumbnailScore;
15 struct ViewMsg_Navigate_Params; 24 struct ViewMsg_Navigate_Params;
16 25
17 namespace WebKit { 26 namespace WebKit {
18 class WebView; 27 class WebView;
19 } 28 }
20 29
21 namespace safe_browsing { 30 namespace safe_browsing {
22 class PhishingClassifierDelegate; 31 class PhishingClassifierDelegate;
23 } 32 }
24 33
34 namespace webkit_glue {
35 class ImageResourceFetcher;
36 }
37
25 // This class holds the Chrome specific parts of RenderView, and has the same 38 // This class holds the Chrome specific parts of RenderView, and has the same
26 // lifetime. 39 // lifetime.
27 class ChromeRenderViewObserver : public RenderViewObserver { 40 class ChromeRenderViewObserver : public RenderViewObserver,
41 public WebKit::WebPageSerializerClient {
28 public: 42 public:
29 // translate_helper and/or phishing_classifier can be NULL. 43 // translate_helper and/or phishing_classifier can be NULL.
30 ChromeRenderViewObserver( 44 ChromeRenderViewObserver(
31 RenderView* render_view, 45 RenderView* render_view,
32 TranslateHelper* translate_helper, 46 TranslateHelper* translate_helper,
33 safe_browsing::PhishingClassifierDelegate* phishing_classifier); 47 safe_browsing::PhishingClassifierDelegate* phishing_classifier);
34 virtual ~ChromeRenderViewObserver(); 48 virtual ~ChromeRenderViewObserver();
35 49
36 private: 50 private:
37 // RenderViewObserver implementation. 51 // RenderViewObserver implementation.
38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
39 virtual void DidStopLoading() OVERRIDE; 53 virtual void DidStopLoading() OVERRIDE;
54 virtual void DidChangeIcons(WebKit::WebFrame* frame) OVERRIDE;
40 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, 55 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
41 bool is_new_navigation) OVERRIDE; 56 bool is_new_navigation) OVERRIDE;
57 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
58
59 // WebKit::WebPageSerializerClient implementation.
60 virtual void didSerializeDataForFrame(const WebKit::WebURL& frame_url,
61 const WebKit::WebCString& data,
62 PageSerializationStatus status);
42 63
43 void OnCaptureSnapshot(); 64 void OnCaptureSnapshot();
65 void OnHandleMessageFromExternalHost(const std::string& message,
66 const std::string& origin,
67 const std::string& target);
68 void OnJavaScriptStressTestControl(int cmd, int param);
69 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url);
70 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks(
71 const std::vector<GURL>& links,
72 const std::vector<FilePath>& local_paths,
73 const FilePath& local_directory_name);
74 void OnDownloadFavicon(int id, const GURL& image_url, int image_size);
75 void OnEnableViewSourceMode();
44 void OnNavigate(const ViewMsg_Navigate_Params& params); 76 void OnNavigate(const ViewMsg_Navigate_Params& params);
45 77
46 // Captures the thumbnail and text contents for indexing for the given load 78 // Captures the thumbnail and text contents for indexing for the given load
47 // ID. If the view's load ID is different than the parameter, this call is 79 // ID. If the view's load ID is different than the parameter, this call is
48 // a NOP. Typically called on a timer, so the load ID may have changed in the 80 // a NOP. Typically called on a timer, so the load ID may have changed in the
49 // meantime. 81 // meantime.
50 void CapturePageInfo(int load_id, bool preliminary_capture); 82 void CapturePageInfo(int load_id, bool preliminary_capture);
51 83
52 // Retrieves the text from the given frame contents, the page text up to the 84 // Retrieves the text from the given frame contents, the page text up to the
53 // maximum amount kMaxIndexChars will be placed into the given buffer. 85 // maximum amount kMaxIndexChars will be placed into the given buffer.
54 void CaptureText(WebKit::WebFrame* frame, string16* contents); 86 void CaptureText(WebKit::WebFrame* frame, string16* contents);
55 87
56 void CaptureThumbnail(); 88 void CaptureThumbnail();
57 89
58 // Creates a thumbnail of |frame|'s contents resized to (|w|, |h|) 90 // Creates a thumbnail of |frame|'s contents resized to (|w|, |h|)
59 // and puts that in |thumbnail|. Thumbnail metadata goes in |score|. 91 // and puts that in |thumbnail|. Thumbnail metadata goes in |score|.
60 bool CaptureFrameThumbnail(WebKit::WebView* view, int w, int h, 92 bool CaptureFrameThumbnail(WebKit::WebView* view, int w, int h,
61 SkBitmap* thumbnail, 93 SkBitmap* thumbnail,
62 ThumbnailScore* score); 94 ThumbnailScore* score);
63 95
64 // Capture a snapshot of a view. This is used to allow an extension 96 // Capture a snapshot of a view. This is used to allow an extension
65 // to get a snapshot of a tab using chrome.tabs.captureVisibleTab(). 97 // to get a snapshot of a tab using chrome.tabs.captureVisibleTab().
66 bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot); 98 bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot);
67 99
68 // Has the same lifetime as us. 100 // Exposes the DOMAutomationController object that allows JS to send
101 // information to the browser process.
102 void BindDOMAutomationController(WebKit::WebFrame* webframe);
103
104 ExternalHostBindings* GetExternalHostBindings();
105
106 // This callback is triggered when DownloadFavicon completes, either
107 // succesfully or with a failure. See DownloadFavicon for more
108 // details.
109 void DidDownloadFavicon(webkit_glue::ImageResourceFetcher* fetcher,
110 const SkBitmap& image);
111
112 // Requests to download a favicon image. When done, the RenderView
113 // is notified by way of DidDownloadFavicon. Returns true if the
114 // request was successfully started, false otherwise. id is used to
115 // uniquely identify the request and passed back to the
116 // DidDownloadFavicon method. If the image has multiple frames, the
117 // frame whose size is image_size is returned. If the image doesn't
118 // have a frame at the specified size, the first is returned.
119 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
120
121 // Decodes a data: URL image or returns an empty image in case of failure.
122 SkBitmap ImageFromDataUrl(const GURL&) const;
123
124 // Have the same lifetime as us.
69 TranslateHelper* translate_helper_; 125 TranslateHelper* translate_helper_;
70 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; 126 safe_browsing::PhishingClassifierDelegate* phishing_classifier_;
71 127
72 // Page_id from the last page we indexed. This prevents us from indexing the 128 // Page_id from the last page we indexed. This prevents us from indexing the
73 // same page twice in a row. 129 // same page twice in a row.
74 int32 last_indexed_page_id_; 130 int32 last_indexed_page_id_;
75 131
132 // Allows JS to access DOM automation. The JS object is only exposed when the
133 // DOM automation bindings are enabled.
134 scoped_ptr<DomAutomationController> dom_automation_controller_;
135
136 // External host exposed through automation controller.
137 scoped_ptr<ExternalHostBindings> external_host_bindings_;
138
76 ScopedRunnableMethodFactory<ChromeRenderViewObserver> 139 ScopedRunnableMethodFactory<ChromeRenderViewObserver>
77 page_info_method_factory_; 140 page_info_method_factory_;
78 141
142 // ImageResourceFetchers schedule via DownloadImage.
143 RenderView::ImageResourceFetcherList image_fetchers_;
144
79 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver); 145 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver);
80 }; 146 };
81 147
82 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_ 148 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698