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

Side by Side Diff: components/pdf/browser/pdf_web_contents_helper.h

Issue 2455543002: Convert PDF component IPC to mojo. (Closed)
Patch Set: Feedback Created 3 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
« no previous file with comments | « components/pdf/browser/BUILD.gn ('k') | components/pdf/browser/pdf_web_contents_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_ 5 #ifndef COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_
6 #define COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_ 6 #define COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/pdf/common/pdf.mojom.h"
14 #include "content/public/browser/web_contents_binding_set.h"
13 #include "content/public/browser/web_contents_observer.h" 15 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h" 16 #include "content/public/browser/web_contents_user_data.h"
15 #include "ipc/ipc_message.h"
16 17
17 namespace content { 18 namespace content {
18 class WebContents; 19 class WebContents;
19 } 20 }
20 21
21 namespace pdf { 22 namespace pdf {
22 23
23 class PDFWebContentsHelperClient; 24 class PDFWebContentsHelperClient;
24 25
25 // Per-WebContents class to handle PDF messages. 26 // Per-WebContents class to handle PDF messages.
26 class PDFWebContentsHelper 27 class PDFWebContentsHelper
27 : public content::WebContentsObserver, 28 : public content::WebContentsObserver,
28 public content::WebContentsUserData<PDFWebContentsHelper> { 29 public content::WebContentsUserData<PDFWebContentsHelper>,
30 public mojom::PdfService {
29 public: 31 public:
30 static void CreateForWebContentsWithClient( 32 static void CreateForWebContentsWithClient(
31 content::WebContents* contents, 33 content::WebContents* contents,
32 std::unique_ptr<PDFWebContentsHelperClient> client); 34 std::unique_ptr<PDFWebContentsHelperClient> client);
33 35
34 private: 36 private:
35 PDFWebContentsHelper(content::WebContents* web_contents, 37 PDFWebContentsHelper(content::WebContents* web_contents,
36 std::unique_ptr<PDFWebContentsHelperClient> client); 38 std::unique_ptr<PDFWebContentsHelperClient> client);
37 ~PDFWebContentsHelper() override; 39 ~PDFWebContentsHelper() override;
38 40
39 // content::WebContentsObserver overrides: 41 // mojom::PdfService:
40 bool OnMessageReceived(const IPC::Message& message, 42 void HasUnsupportedFeature() override;
41 content::RenderFrameHost* render_frame_host) override; 43 void SaveUrlAs(const GURL& url, const content::Referrer& referrer) override;
44 void UpdateContentRestrictions(int32_t content_restrictions) override;
42 45
43 // Message handlers. 46 content::WebContentsFrameBindingSet<mojom::PdfService> pdf_service_bindings_;
44 void OnHasUnsupportedFeature();
45 void OnSaveURLAs(const GURL& url, const content::Referrer& referrer);
46 void OnUpdateContentRestrictions(int content_restrictions);
47
48 std::unique_ptr<PDFWebContentsHelperClient> client_; 47 std::unique_ptr<PDFWebContentsHelperClient> client_;
49 48
50 DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelper); 49 DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelper);
51 }; 50 };
52 51
53 } // namespace pdf 52 } // namespace pdf
54 53
55 #endif // COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_ 54 #endif // COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_
OLDNEW
« no previous file with comments | « components/pdf/browser/BUILD.gn ('k') | components/pdf/browser/pdf_web_contents_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698