| 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_infobar_delegate.h" | 5 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.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/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| 11 #include "chrome/browser/plugins/plugin_finder.h" | 11 #include "chrome/browser/plugins/plugin_finder.h" |
| 12 #include "chrome/browser/plugins/plugin_metadata.h" | 12 #include "chrome/browser/plugins/plugin_metadata.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "content/public/browser/page_navigator.h" | 15 #include "content/public/browser/page_navigator.h" |
| 16 #include "content/public/browser/plugin_service.h" | 16 #include "content/public/browser/plugin_service.h" |
| 17 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/common/referrer.h" | 19 #include "content/public/common/referrer.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | |
| 25 #include "webkit/plugins/webplugininfo.h" | 24 #include "webkit/plugins/webplugininfo.h" |
| 26 | 25 |
| 27 #if defined(GOOGLE_TV) | 26 #if defined(GOOGLE_TV) |
| 28 #include "base/android/context_types.h" | 27 #include "base/android/context_types.h" |
| 29 #endif | 28 #endif |
| 30 | 29 |
| 31 // The URL for the "learn more" article about the PPAPI broker. | 30 // The URL for the "learn more" article about the PPAPI broker. |
| 32 const char kPpapiBrokerLearnMoreUrl[] = | 31 const char kPpapiBrokerLearnMoreUrl[] = |
| 33 "https://support.google.com/chrome/?p=ib_pepper_broker"; | 32 "https://support.google.com/chrome/?p=ib_pepper_broker"; |
| 34 | 33 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 content_settings_(content_settings), | 142 content_settings_(content_settings), |
| 144 tab_content_settings_(tab_content_settings), | 143 tab_content_settings_(tab_content_settings), |
| 145 callback_(callback) { | 144 callback_(callback) { |
| 146 } | 145 } |
| 147 | 146 |
| 148 PepperBrokerInfoBarDelegate::~PepperBrokerInfoBarDelegate() { | 147 PepperBrokerInfoBarDelegate::~PepperBrokerInfoBarDelegate() { |
| 149 if (!callback_.is_null()) | 148 if (!callback_.is_null()) |
| 150 callback_.Run(false); | 149 callback_.Run(false); |
| 151 } | 150 } |
| 152 | 151 |
| 153 gfx::Image* PepperBrokerInfoBarDelegate::GetIcon() const { | 152 int PepperBrokerInfoBarDelegate::GetIconID() const { |
| 154 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 153 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 155 IDR_INFOBAR_PLUGIN_INSTALL); | |
| 156 } | 154 } |
| 157 | 155 |
| 158 string16 PepperBrokerInfoBarDelegate::GetMessageText() const { | 156 string16 PepperBrokerInfoBarDelegate::GetMessageText() const { |
| 159 content::PluginService* plugin_service = | 157 content::PluginService* plugin_service = |
| 160 content::PluginService::GetInstance(); | 158 content::PluginService::GetInstance(); |
| 161 webkit::WebPluginInfo plugin; | 159 webkit::WebPluginInfo plugin; |
| 162 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); | 160 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); |
| 163 DCHECK(success); | 161 DCHECK(success); |
| 164 scoped_ptr<PluginMetadata> plugin_metadata( | 162 scoped_ptr<PluginMetadata> plugin_metadata( |
| 165 PluginFinder::GetInstance()->GetPluginMetadata(plugin)); | 163 PluginFinder::GetInstance()->GetPluginMetadata(plugin)); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 content::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); | 215 content::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); |
| 218 callback_.Run(result); | 216 callback_.Run(result); |
| 219 callback_ = base::Callback<void(bool)>(); | 217 callback_ = base::Callback<void(bool)>(); |
| 220 content_settings_->SetContentSetting( | 218 content_settings_->SetContentSetting( |
| 221 ContentSettingsPattern::FromURLNoWildcard(url_), | 219 ContentSettingsPattern::FromURLNoWildcard(url_), |
| 222 ContentSettingsPattern::Wildcard(), | 220 ContentSettingsPattern::Wildcard(), |
| 223 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 221 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
| 224 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 222 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
| 225 tab_content_settings_->SetPepperBrokerAllowed(result); | 223 tab_content_settings_->SetPepperBrokerAllowed(result); |
| 226 } | 224 } |
| OLD | NEW |