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

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

Issue 6873014: Clear RenderThread of any Chrome specific code, and move a bunch of stuff out of RenderView. (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_OBSERVER_H_ 5 #ifndef CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
6 #define CHROME_RENDERER_CHROME_RENDER_OBSERVER_H_ 6 #define CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "content/renderer/render_view_observer.h" 10 #include "content/renderer/render_view_observer.h"
11 11
12 class SkBitmap; 12 class SkBitmap;
13 class TranslateHelper; 13 class TranslateHelper;
14 struct ThumbnailScore; 14 struct ThumbnailScore;
15 struct ViewMsg_Navigate_Params;
15 16
16 namespace WebKit { 17 namespace WebKit {
17 class WebView; 18 class WebView;
18 } 19 }
19 20
20 namespace safe_browsing { 21 namespace safe_browsing {
21 class PhishingClassifierDelegate; 22 class PhishingClassifierDelegate;
22 } 23 }
23 24
24 // This class holds the Chrome specific parts of RenderView, and has the same 25 // This class holds the Chrome specific parts of RenderView, and has the same
25 // lifetime. 26 // lifetime.
26 class ChromeRenderObserver : public RenderViewObserver { 27 class ChromeRenderViewObserver : public RenderViewObserver {
27 public: 28 public:
28 // translate_helper and/or phishing_classifier can be NULL. 29 // translate_helper and/or phishing_classifier can be NULL.
29 ChromeRenderObserver( 30 ChromeRenderViewObserver(
30 RenderView* render_view, 31 RenderView* render_view,
31 TranslateHelper* translate_helper, 32 TranslateHelper* translate_helper,
32 safe_browsing::PhishingClassifierDelegate* phishing_classifier); 33 safe_browsing::PhishingClassifierDelegate* phishing_classifier);
33 virtual ~ChromeRenderObserver(); 34 virtual ~ChromeRenderViewObserver();
34 35
35 private: 36 private:
36 // RenderViewObserver implementation. 37 // RenderViewObserver implementation.
37 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
38 virtual void DidStopLoading() OVERRIDE; 39 virtual void DidStopLoading() OVERRIDE;
39 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame, 40 virtual void DidCommitProvisionalLoad(WebKit::WebFrame* frame,
40 bool is_new_navigation) OVERRIDE; 41 bool is_new_navigation) OVERRIDE;
41 42
42 void OnCaptureSnapshot(); 43 void OnCaptureSnapshot();
44 void OnNavigate(const ViewMsg_Navigate_Params& params);
43 45
44 // Captures the thumbnail and text contents for indexing for the given load 46 // Captures the thumbnail and text contents for indexing for the given load
45 // ID. If the view's load ID is different than the parameter, this call is 47 // ID. If the view's load ID is different than the parameter, this call is
46 // a NOP. Typically called on a timer, so the load ID may have changed in the 48 // a NOP. Typically called on a timer, so the load ID may have changed in the
47 // meantime. 49 // meantime.
48 void CapturePageInfo(int load_id, bool preliminary_capture); 50 void CapturePageInfo(int load_id, bool preliminary_capture);
49 51
50 // Retrieves the text from the given frame contents, the page text up to the 52 // Retrieves the text from the given frame contents, the page text up to the
51 // maximum amount kMaxIndexChars will be placed into the given buffer. 53 // maximum amount kMaxIndexChars will be placed into the given buffer.
52 void CaptureText(WebKit::WebFrame* frame, string16* contents); 54 void CaptureText(WebKit::WebFrame* frame, string16* contents);
53 55
54 void CaptureThumbnail(); 56 void CaptureThumbnail();
55 57
56 // Creates a thumbnail of |frame|'s contents resized to (|w|, |h|) 58 // Creates a thumbnail of |frame|'s contents resized to (|w|, |h|)
57 // and puts that in |thumbnail|. Thumbnail metadata goes in |score|. 59 // and puts that in |thumbnail|. Thumbnail metadata goes in |score|.
58 bool CaptureFrameThumbnail(WebKit::WebView* view, int w, int h, 60 bool CaptureFrameThumbnail(WebKit::WebView* view, int w, int h,
59 SkBitmap* thumbnail, 61 SkBitmap* thumbnail,
60 ThumbnailScore* score); 62 ThumbnailScore* score);
61 63
62 // Capture a snapshot of a view. This is used to allow an extension 64 // Capture a snapshot of a view. This is used to allow an extension
63 // to get a snapshot of a tab using chrome.tabs.captureVisibleTab(). 65 // to get a snapshot of a tab using chrome.tabs.captureVisibleTab().
64 bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot); 66 bool CaptureSnapshot(WebKit::WebView* view, SkBitmap* snapshot);
65 67
66 // Has the same lifetime as us. 68 // Has the same lifetime as us.
67 TranslateHelper* translate_helper_; 69 TranslateHelper* translate_helper_;
68 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; 70 safe_browsing::PhishingClassifierDelegate* phishing_classifier_;
69 71
70 // Page_id from the last page we indexed. This prevents us from indexing the 72 // Page_id from the last page we indexed. This prevents us from indexing the
71 // same page twice in a row. 73 // same page twice in a row.
72 int32 last_indexed_page_id_; 74 int32 last_indexed_page_id_;
73 75
74 ScopedRunnableMethodFactory<ChromeRenderObserver> page_info_method_factory_; 76 ScopedRunnableMethodFactory<ChromeRenderViewObserver>
77 page_info_method_factory_;
75 78
76 DISALLOW_COPY_AND_ASSIGN(ChromeRenderObserver); 79 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewObserver);
77 }; 80 };
78 81
79 #endif // CHROME_RENDERER_CHROME_OBSERVER_H_ 82 #endif // CHROME_RENDERER_CHROME_RENDER_VIEW_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_process_observer.cc ('k') | chrome/renderer/chrome_render_view_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698