| OLD | NEW |
| 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 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" | 5 #include "chrome/browser/ui/pdf/pdf_unsupported_feature.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
| 33 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
| 34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "grit/browser_resources.h" | 35 #include "grit/browser_resources.h" |
| 36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
| 37 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
| 39 #include "ui/base/layout.h" | 39 #include "ui/base/layout.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "ui/gfx/image/image.h" | 41 #include "ui/gfx/image/image.h" |
| 42 #include "webkit/plugins/npapi/plugin_group.h" | |
| 43 | 42 |
| 44 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 45 #include "base/win/metro.h" | 44 #include "base/win/metro.h" |
| 46 #endif | 45 #endif |
| 47 | 46 |
| 48 using content::InterstitialPage; | 47 using content::InterstitialPage; |
| 49 using content::OpenURLParams; | 48 using content::OpenURLParams; |
| 50 using content::PluginService; | 49 using content::PluginService; |
| 51 using content::Referrer; | 50 using content::Referrer; |
| 52 using content::UserMetricsAction; | 51 using content::UserMetricsAction; |
| 53 using content::WebContents; | 52 using content::WebContents; |
| 54 using webkit::npapi::PluginGroup; | |
| 55 using webkit::WebPluginInfo; | 53 using webkit::WebPluginInfo; |
| 56 | 54 |
| 57 namespace { | 55 namespace { |
| 58 | 56 |
| 59 static const char kAdobeReaderIdentifier[] = "adobe-reader"; | 57 static const char kAdobeReaderIdentifier[] = "adobe-reader"; |
| 60 static const char kAdobeReaderUpdateUrl[] = | 58 static const char kAdobeReaderUpdateUrl[] = |
| 61 "http://www.adobe.com/go/getreader_chrome"; | 59 "http://www.adobe.com/go/getreader_chrome"; |
| 62 | 60 |
| 63 // The info bar delegate used to ask the user if they want to use Adobe Reader | 61 // The info bar delegate used to ask the user if they want to use Adobe Reader |
| 64 // by default. We want the infobar to have [No][Yes], so we swap the text on | 62 // by default. We want the infobar to have [No][Yes], so we swap the text on |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 124 } |
| 127 | 125 |
| 128 string16 PDFEnableAdobeReaderInfoBarDelegate::GetMessageText() const { | 126 string16 PDFEnableAdobeReaderInfoBarDelegate::GetMessageText() const { |
| 129 return l10n_util::GetStringUTF16(IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER); | 127 return l10n_util::GetStringUTF16(IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER); |
| 130 } | 128 } |
| 131 | 129 |
| 132 void PDFEnableAdobeReaderInfoBarDelegate::OnYes() { | 130 void PDFEnableAdobeReaderInfoBarDelegate::OnYes() { |
| 133 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarOK")); | 131 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarOK")); |
| 134 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile_); | 132 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile_); |
| 135 plugin_prefs->EnablePluginGroup( | 133 plugin_prefs->EnablePluginGroup( |
| 136 true, ASCIIToUTF16(webkit::npapi::PluginGroup::kAdobeReaderGroupName)); | 134 true, ASCIIToUTF16(PluginMetadata::kAdobeReaderGroupName)); |
| 137 plugin_prefs->EnablePluginGroup( | 135 plugin_prefs->EnablePluginGroup( |
| 138 false, ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); | 136 false, ASCIIToUTF16(chrome::ChromeContentClient::kPDFPluginName)); |
| 139 } | 137 } |
| 140 | 138 |
| 141 void PDFEnableAdobeReaderInfoBarDelegate::OnNo() { | 139 void PDFEnableAdobeReaderInfoBarDelegate::OnNo() { |
| 142 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarCancel")); | 140 content::RecordAction(UserMetricsAction("PDF_EnableReaderInfoBarCancel")); |
| 143 } | 141 } |
| 144 | 142 |
| 145 // Launch the url to get the latest Adbobe Reader installer. | 143 // Launch the url to get the latest Adbobe Reader installer. |
| 146 void OpenReaderUpdateURL(WebContents* tab) { | 144 void OpenReaderUpdateURL(WebContents* tab) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 404 |
| 407 void PDFHasUnsupportedFeature(content::WebContents* web_contents) { | 405 void PDFHasUnsupportedFeature(content::WebContents* web_contents) { |
| 408 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) | 406 #if defined(OS_WIN) && defined(ENABLE_PLUGIN_INSTALLATION) |
| 409 // Only works for Windows for now. For Mac, we'll have to launch the file | 407 // Only works for Windows for now. For Mac, we'll have to launch the file |
| 410 // externally since Adobe Reader doesn't work inside Chrome. | 408 // externally since Adobe Reader doesn't work inside Chrome. |
| 411 PluginService::GetInstance()->GetPlugins(base::Bind(&GotPluginsCallback, | 409 PluginService::GetInstance()->GetPlugins(base::Bind(&GotPluginsCallback, |
| 412 web_contents->GetRenderProcessHost()->GetID(), | 410 web_contents->GetRenderProcessHost()->GetID(), |
| 413 web_contents->GetRenderViewHost()->GetRoutingID())); | 411 web_contents->GetRenderViewHost()->GetRoutingID())); |
| 414 #endif | 412 #endif |
| 415 } | 413 } |
| OLD | NEW |