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

Side by Side Diff: chrome/browser/ui/pdf/chrome_pdf_tab_helper_delegate.cc

Issue 477263003: pdf: Create a separate component for using the pdf pepper plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 3 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
(Empty)
1 // Copyright 2014 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.
4
5 #include "chrome/browser/ui/pdf/chrome_pdf_tab_helper_delegate.h"
6
7 #include "chrome/browser/download/download_stats.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/location_bar/location_bar.h"
12 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h"
13 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
14
15 ChromePDFTabHelperDelegate::ChromePDFTabHelperDelegate() {
16 }
17
18 ChromePDFTabHelperDelegate::~ChromePDFTabHelperDelegate() {
19 }
20
21 void ChromePDFTabHelperDelegate::UpdateLocationBar(
22 content::WebContents* contents) {
23 Browser* browser = chrome::FindBrowserWithWebContents(contents);
24 if (!browser)
25 return;
26
27 BrowserWindow* window = browser->window();
28 if (!window)
29 return;
30
31 LocationBar* location_bar = window->GetLocationBar();
32 if (!location_bar)
33 return;
34
35 location_bar->UpdateOpenPDFInReaderPrompt();
36 }
37
38 void ChromePDFTabHelperDelegate::UpdateContentRestrictions(
39 content::WebContents* contents,
40 int content_restrictions) {
41 CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(contents);
42 // |core_tab_helper| is NULL for WebViewGuest.
43 if (core_tab_helper)
44 core_tab_helper->UpdateContentRestrictions(content_restrictions);
45 }
46
47 void ChromePDFTabHelperDelegate::OnPDFHasUnsupportedFeature(
48 content::WebContents* contents) {
49 PDFHasUnsupportedFeature(contents);
50 }
51
52 void ChromePDFTabHelperDelegate::OnSaveURL(content::WebContents* contents) {
53 RecordDownloadSource(DOWNLOAD_INITIATED_BY_PDF_SAVE);
54 }
55
56 void ChromePDFTabHelperDelegate::OnShowPDFPasswordDialog(
57 content::WebContents* contents,
58 const base::string16& prompt,
59 const pdf::PasswordDialogClosedCallback& callback) {
60 ShowPDFPasswordDialog(contents, prompt, callback);
61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698