[Media Router] Add integration tests and e2e tests for media router and presentation...
[chromium-blink-merge.git] / components / pdf / browser / pdf_web_contents_helper.h
blob8d805f05178ec5262ddc825a778a10e48b3870a1
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_
6 #define COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h"
14 #include "ipc/ipc_message.h"
16 namespace content {
17 class WebContents;
20 namespace pdf {
22 class OpenPDFInReaderPromptClient;
23 class PDFWebContentsHelperClient;
25 // Per-WebContents class to handle PDF messages.
26 class PDFWebContentsHelper
27 : public content::WebContentsObserver,
28 public content::WebContentsUserData<PDFWebContentsHelper> {
29 public:
30 static void CreateForWebContentsWithClient(
31 content::WebContents* contents,
32 scoped_ptr<PDFWebContentsHelperClient> client);
34 OpenPDFInReaderPromptClient* open_in_reader_prompt() const {
35 return open_in_reader_prompt_.get();
38 void ShowOpenInReaderPrompt(scoped_ptr<OpenPDFInReaderPromptClient> prompt);
40 private:
41 PDFWebContentsHelper(content::WebContents* web_contents,
42 scoped_ptr<PDFWebContentsHelperClient> client);
43 ~PDFWebContentsHelper() override;
45 // content::WebContentsObserver overrides:
46 bool OnMessageReceived(const IPC::Message& message) override;
47 void DidNavigateMainFrame(
48 const content::LoadCommittedDetails& details,
49 const content::FrameNavigateParams& params) override;
51 // Internal helpers ----------------------------------------------------------
53 void UpdateLocationBar();
55 // Message handlers.
56 void OnHasUnsupportedFeature();
57 void OnSaveURLAs(const GURL& url, const content::Referrer& referrer);
58 void OnUpdateContentRestrictions(int content_restrictions);
60 // The model for the confirmation prompt to open a PDF in Adobe Reader.
61 scoped_ptr<OpenPDFInReaderPromptClient> open_in_reader_prompt_;
62 scoped_ptr<PDFWebContentsHelperClient> client_;
64 DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelper);
67 } // namespace pdf
69 #endif // COMPONENTS_PDF_BROWSER_PDF_WEB_CONTENTS_HELPER_H_