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

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

Issue 2737893002: Mojoify the RequestThumbnailForContextNode IPC message and reply (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_FRAME_OBSERVER_H_ 5 #ifndef CHROME_RENDERER_CHROME_RENDER_FRAME_OBSERVER_H_
6 #define CHROME_RENDERER_CHROME_RENDER_FRAME_OBSERVER_H_ 6 #define CHROME_RENDERER_CHROME_RENDER_FRAME_OBSERVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "chrome/common/prerender_types.h" 10 #include "chrome/common/prerender_types.h"
11 #include "chrome/common/thumbnail_capturer.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h" 12 #include "content/public/renderer/render_frame_observer.h"
13 #include "mojo/public/cpp/bindings/binding_set.h"
12 14
13 namespace gfx { 15 namespace gfx {
14 class Size; 16 class Size;
15 } 17 }
16 18
17 namespace safe_browsing { 19 namespace safe_browsing {
18 class PhishingClassifierDelegate; 20 class PhishingClassifierDelegate;
19 } 21 }
20 22
21 namespace translate { 23 namespace translate {
22 class TranslateHelper; 24 class TranslateHelper;
23 } 25 }
24 26
25 // This class holds the Chrome specific parts of RenderFrame, and has the same 27 // This class holds the Chrome specific parts of RenderFrame, and has the same
26 // lifetime. 28 // lifetime.
27 class ChromeRenderFrameObserver : public content::RenderFrameObserver { 29 class ChromeRenderFrameObserver : public content::RenderFrameObserver,
30 public chrome::mojom::ThumbnailCapturer {
28 public: 31 public:
29 explicit ChromeRenderFrameObserver(content::RenderFrame* render_frame); 32 explicit ChromeRenderFrameObserver(content::RenderFrame* render_frame);
30 ~ChromeRenderFrameObserver() override; 33 ~ChromeRenderFrameObserver() override;
31 34
32 private: 35 private:
33 enum TextCaptureType { PRELIMINARY_CAPTURE, FINAL_CAPTURE }; 36 enum TextCaptureType { PRELIMINARY_CAPTURE, FINAL_CAPTURE };
34 37
35 // RenderFrameObserver implementation. 38 // RenderFrameObserver implementation.
36 bool OnMessageReceived(const IPC::Message& message) override; 39 bool OnMessageReceived(const IPC::Message& message) override;
37 void DidStartProvisionalLoad(blink::WebDataSource* data_source) override; 40 void DidStartProvisionalLoad(blink::WebDataSource* data_source) override;
38 void DidFinishLoad() override; 41 void DidFinishLoad() override;
39 void DidCommitProvisionalLoad(bool is_new_navigation, 42 void DidCommitProvisionalLoad(bool is_new_navigation,
40 bool is_same_page_navigation) override; 43 bool is_same_page_navigation) override;
41 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override; 44 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
42 void OnDestruct() override; 45 void OnDestruct() override;
43 46
47 void OnThumbnailCapturerRequest(
48 chrome::mojom::ThumbnailCapturerRequest request);
49 void RequestThumbnailForContextNode(
tibell 2017/03/08 04:19:49 We typically add a // chrome::mojom::ThumbnailC
50 int32_t thumbnail_min_area_pixels,
51 const gfx::Size& thumbnail_max_size_pixels,
52 const RequestThumbnailForContextNodeCallback& callback) override;
53
44 // IPC handlers 54 // IPC handlers
45 void OnSetIsPrerendering(prerender::PrerenderMode mode); 55 void OnSetIsPrerendering(prerender::PrerenderMode mode);
46 void OnRequestReloadImageForContextNode(); 56 void OnRequestReloadImageForContextNode();
47 void OnRequestThumbnailForContextNode( 57 void OnRequestThumbnailForContextNode(
48 int thumbnail_min_area_pixels, 58 int thumbnail_min_area_pixels,
49 const gfx::Size& thumbnail_max_size_pixels, 59 const gfx::Size& thumbnail_max_size_pixels,
50 int callback_id); 60 int callback_id);
51 void OnPrintNodeUnderContextMenu(); 61 void OnPrintNodeUnderContextMenu();
52 void OnSetClientSidePhishingDetection(bool enable_phishing_detection); 62 void OnSetClientSidePhishingDetection(bool enable_phishing_detection);
53 63
54 // Captures page information using the top (main) frame of a frame tree. 64 // Captures page information using the top (main) frame of a frame tree.
55 // Currently, this page information is just the text content of the all 65 // Currently, this page information is just the text content of the all
56 // frames, collected and concatenated until a certain limit (kMaxIndexChars) 66 // frames, collected and concatenated until a certain limit (kMaxIndexChars)
57 // is reached. 67 // is reached.
58 // TODO(dglazkov): This is incompatible with OOPIF and needs to be updated. 68 // TODO(dglazkov): This is incompatible with OOPIF and needs to be updated.
59 void CapturePageText(TextCaptureType capture_type); 69 void CapturePageText(TextCaptureType capture_type);
60 70
61 void CapturePageTextLater(TextCaptureType capture_type, 71 void CapturePageTextLater(TextCaptureType capture_type,
62 base::TimeDelta delay); 72 base::TimeDelta delay);
63 73
64 // Have the same lifetime as us. 74 // Have the same lifetime as us.
65 translate::TranslateHelper* translate_helper_; 75 translate::TranslateHelper* translate_helper_;
66 safe_browsing::PhishingClassifierDelegate* phishing_classifier_; 76 safe_browsing::PhishingClassifierDelegate* phishing_classifier_;
67 77
78 mojo::BindingSet<chrome::mojom::ThumbnailCapturer>
79 thumbnail_capturer_bindings_;
80
68 DISALLOW_COPY_AND_ASSIGN(ChromeRenderFrameObserver); 81 DISALLOW_COPY_AND_ASSIGN(ChromeRenderFrameObserver);
69 }; 82 };
70 83
71 #endif // CHROME_RENDERER_CHROME_RENDER_FRAME_OBSERVER_H_ 84 #endif // CHROME_RENDERER_CHROME_RENDER_FRAME_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698