| 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/pepper_broker_observer.h" | 5 #include "chrome/browser/pepper_broker_observer.h" |
| 6 | 6 |
| 7 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 7 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/infobars/infobar_tab_helper.h" | 9 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 10 #include "chrome/browser/plugins/plugin_finder.h" |
| 11 #include "chrome/browser/plugins/plugin_metadata.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 13 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 14 #include "content/public/browser/page_navigator.h" | 16 #include "content/public/browser/page_navigator.h" |
| 15 #include "content/public/browser/plugin_service.h" | 17 #include "content/public/browser/plugin_service.h" |
| 16 #include "content/public/browser/user_metrics.h" | 18 #include "content/public/browser/user_metrics.h" |
| 17 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/common/referrer.h" | 20 #include "content/public/common/referrer.h" |
| 19 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 20 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 21 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "webkit/plugins/npapi/plugin_group.h" | |
| 25 #include "webkit/plugins/npapi/plugin_list.h" | 26 #include "webkit/plugins/npapi/plugin_list.h" |
| 26 #include "webkit/plugins/webplugininfo.h" | 27 #include "webkit/plugins/webplugininfo.h" |
| 27 | 28 |
| 28 using content::OpenURLParams; | 29 using content::OpenURLParams; |
| 29 using content::Referrer; | 30 using content::Referrer; |
| 30 using content::WebContents; | 31 using content::WebContents; |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 // The URL for the "learn more" article about the PPAPI broker. | 35 // The URL for the "learn more" article about the PPAPI broker. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (!callback_.is_null()) | 92 if (!callback_.is_null()) |
| 92 callback_.Run(false); | 93 callback_.Run(false); |
| 93 } | 94 } |
| 94 | 95 |
| 95 string16 PepperBrokerInfoBarDelegate::GetMessageText() const { | 96 string16 PepperBrokerInfoBarDelegate::GetMessageText() const { |
| 96 content::PluginService* plugin_service = | 97 content::PluginService* plugin_service = |
| 97 content::PluginService::GetInstance(); | 98 content::PluginService::GetInstance(); |
| 98 webkit::WebPluginInfo plugin; | 99 webkit::WebPluginInfo plugin; |
| 99 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); | 100 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); |
| 100 DCHECK(success); | 101 DCHECK(success); |
| 101 scoped_ptr<webkit::npapi::PluginGroup> plugin_group( | 102 PluginMetadata* plugin_metadata = |
| 102 plugin_service->GetPluginList()->GetPluginGroup(plugin)); | 103 PluginFinder::GetInstance()->GetPluginMetadata(plugin); |
| 103 return l10n_util::GetStringFUTF16(IDS_PEPPER_BROKER_MESSAGE, | 104 return l10n_util::GetStringFUTF16(IDS_PEPPER_BROKER_MESSAGE, |
| 104 plugin_group->GetGroupName(), | 105 plugin_metadata->name(), |
| 105 net::FormatUrl(url_.GetOrigin(), | 106 net::FormatUrl(url_.GetOrigin(), |
| 106 languages_)); | 107 languages_)); |
| 107 } | 108 } |
| 108 | 109 |
| 109 int PepperBrokerInfoBarDelegate::GetButtons() const { | 110 int PepperBrokerInfoBarDelegate::GetButtons() const { |
| 110 return BUTTON_OK | BUTTON_CANCEL; | 111 return BUTTON_OK | BUTTON_CANCEL; |
| 111 } | 112 } |
| 112 | 113 |
| 113 string16 PepperBrokerInfoBarDelegate::GetButtonLabel( | 114 string16 PepperBrokerInfoBarDelegate::GetButtonLabel( |
| 114 InfoBarButton button) const { | 115 InfoBarButton button) const { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 infobar_helper, url, plugin_path, languages, content_settings, | 221 infobar_helper, url, plugin_path, languages, content_settings, |
| 221 callback)); | 222 callback)); |
| 222 break; | 223 break; |
| 223 } | 224 } |
| 224 default: | 225 default: |
| 225 NOTREACHED(); | 226 NOTREACHED(); |
| 226 } | 227 } |
| 227 | 228 |
| 228 return true; | 229 return true; |
| 229 } | 230 } |
| OLD | NEW |