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 "content/public/common/webplugininfo.h" |
20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
22 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
24 #include "webkit/plugins/webplugininfo.h" | |
25 | 25 |
26 #if defined(GOOGLE_TV) | 26 #if defined(GOOGLE_TV) |
27 #include "base/android/context_types.h" | 27 #include "base/android/context_types.h" |
28 #endif | 28 #endif |
29 | 29 |
30 | 30 |
31 // static | 31 // static |
32 void PepperBrokerInfoBarDelegate::Create( | 32 void PepperBrokerInfoBarDelegate::Create( |
33 content::WebContents* web_contents, | 33 content::WebContents* web_contents, |
34 const GURL& url, | 34 const GURL& url, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 callback_.Run(false); | 132 callback_.Run(false); |
133 } | 133 } |
134 | 134 |
135 int PepperBrokerInfoBarDelegate::GetIconID() const { | 135 int PepperBrokerInfoBarDelegate::GetIconID() const { |
136 return IDR_INFOBAR_PLUGIN_INSTALL; | 136 return IDR_INFOBAR_PLUGIN_INSTALL; |
137 } | 137 } |
138 | 138 |
139 string16 PepperBrokerInfoBarDelegate::GetMessageText() const { | 139 string16 PepperBrokerInfoBarDelegate::GetMessageText() const { |
140 content::PluginService* plugin_service = | 140 content::PluginService* plugin_service = |
141 content::PluginService::GetInstance(); | 141 content::PluginService::GetInstance(); |
142 webkit::WebPluginInfo plugin; | 142 content::WebPluginInfo plugin; |
143 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); | 143 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); |
144 DCHECK(success); | 144 DCHECK(success); |
145 scoped_ptr<PluginMetadata> plugin_metadata( | 145 scoped_ptr<PluginMetadata> plugin_metadata( |
146 PluginFinder::GetInstance()->GetPluginMetadata(plugin)); | 146 PluginFinder::GetInstance()->GetPluginMetadata(plugin)); |
147 return l10n_util::GetStringFUTF16(IDS_PEPPER_BROKER_MESSAGE, | 147 return l10n_util::GetStringFUTF16(IDS_PEPPER_BROKER_MESSAGE, |
148 plugin_metadata->name(), | 148 plugin_metadata->name(), |
149 net::FormatUrl(url_.GetOrigin(), | 149 net::FormatUrl(url_.GetOrigin(), |
150 languages_)); | 150 languages_)); |
151 } | 151 } |
152 | 152 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 content::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); | 186 content::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); |
187 callback_.Run(result); | 187 callback_.Run(result); |
188 callback_ = base::Callback<void(bool)>(); | 188 callback_ = base::Callback<void(bool)>(); |
189 content_settings_->SetContentSetting( | 189 content_settings_->SetContentSetting( |
190 ContentSettingsPattern::FromURLNoWildcard(url_), | 190 ContentSettingsPattern::FromURLNoWildcard(url_), |
191 ContentSettingsPattern::Wildcard(), | 191 ContentSettingsPattern::Wildcard(), |
192 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 192 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
193 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 193 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
194 tab_content_settings_->SetPepperBrokerAllowed(result); | 194 tab_content_settings_->SetPepperBrokerAllowed(result); |
195 } | 195 } |
OLD | NEW |