app_shell: Add version number in user agent
[chromium-blink-merge.git] / chrome / browser / ui / pdf / pdf_tab_helper.h
blob5dca4a649dc9fa4eb643e4b3d33f4258352dbced
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 CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_PDF_PDF_TAB_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 class OpenPDFInReaderPromptDelegate;
18 namespace content {
19 class WebContents;
22 // Per-tab class to handle PDF messages.
23 class PDFTabHelper : public content::WebContentsObserver,
24 public content::WebContentsUserData<PDFTabHelper> {
25 public:
27 explicit PDFTabHelper(content::WebContents* web_contents);
28 virtual ~PDFTabHelper();
30 OpenPDFInReaderPromptDelegate* open_in_reader_prompt() const {
31 return open_in_reader_prompt_.get();
34 void ShowOpenInReaderPrompt(scoped_ptr<OpenPDFInReaderPromptDelegate> prompt);
36 private:
37 // content::WebContentsObserver overrides:
38 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
39 virtual void DidNavigateMainFrame(
40 const content::LoadCommittedDetails& details,
41 const content::FrameNavigateParams& params) OVERRIDE;
43 // Internal helpers ----------------------------------------------------------
45 void UpdateLocationBar();
46 void OnModalPromptForPasswordClosed(IPC::Message* reply_message,
47 bool success,
48 const base::string16& actual_value);
50 // Message handlers.
51 void OnHasUnsupportedFeature();
52 void OnSaveURLAs(const GURL& url,
53 const content::Referrer& referrer);
54 void OnUpdateContentRestrictions(int content_restrictions);
55 void OnModalPromptForPassword(const std::string& prompt,
56 IPC::Message* reply_message);
58 // The model for the confirmation prompt to open a PDF in Adobe Reader.
59 scoped_ptr<OpenPDFInReaderPromptDelegate> open_in_reader_prompt_;
61 DISALLOW_COPY_AND_ASSIGN(PDFTabHelper);
64 typedef base::Callback<void(bool /* success */,
65 const base::string16& /* password */)>
66 PasswordDialogClosedCallback;
68 // Shows a tab-modal dialog to get a password for a PDF document.
69 void ShowPDFPasswordDialog(content::WebContents* web_contents,
70 const base::string16& prompt,
71 const PasswordDialogClosedCallback& callback);
73 #endif // CHROME_BROWSER_UI_PDF_PDF_TAB_HELPER_H_