| 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_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.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" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 content_settings_(content_settings), | 86 content_settings_(content_settings), |
| 87 tab_content_settings_(tab_content_settings), | 87 tab_content_settings_(tab_content_settings), |
| 88 callback_(callback) { | 88 callback_(callback) { |
| 89 } | 89 } |
| 90 | 90 |
| 91 PepperBrokerInfoBarDelegate::~PepperBrokerInfoBarDelegate() { | 91 PepperBrokerInfoBarDelegate::~PepperBrokerInfoBarDelegate() { |
| 92 if (!callback_.is_null()) | 92 if (!callback_.is_null()) |
| 93 callback_.Run(false); | 93 callback_.Run(false); |
| 94 } | 94 } |
| 95 | 95 |
| 96 infobars::InfoBarDelegate::InfoBarIdentifier |
| 97 PepperBrokerInfoBarDelegate::GetIdentifier() const { |
| 98 return PEPPER_BROKER_INFOBAR_DELEGATE_ID; |
| 99 } |
| 100 |
| 96 int PepperBrokerInfoBarDelegate::GetIconId() const { | 101 int PepperBrokerInfoBarDelegate::GetIconId() const { |
| 97 return IDR_INFOBAR_PLUGIN_INSTALL; | 102 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 98 } | 103 } |
| 99 | 104 |
| 100 base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const { | 105 base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const { |
| 101 content::PluginService* plugin_service = | 106 content::PluginService* plugin_service = |
| 102 content::PluginService::GetInstance(); | 107 content::PluginService::GetInstance(); |
| 103 content::WebPluginInfo plugin; | 108 content::WebPluginInfo plugin; |
| 104 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); | 109 bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); |
| 105 DCHECK(success); | 110 DCHECK(success); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); | 145 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); |
| 141 callback_.Run(result); | 146 callback_.Run(result); |
| 142 callback_ = base::Callback<void(bool)>(); | 147 callback_ = base::Callback<void(bool)>(); |
| 143 content_settings_->SetContentSetting( | 148 content_settings_->SetContentSetting( |
| 144 ContentSettingsPattern::FromURLNoWildcard(url_), | 149 ContentSettingsPattern::FromURLNoWildcard(url_), |
| 145 ContentSettingsPattern::Wildcard(), | 150 ContentSettingsPattern::Wildcard(), |
| 146 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 151 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
| 147 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 152 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
| 148 tab_content_settings_->SetPepperBrokerAllowed(result); | 153 tab_content_settings_->SetPepperBrokerAllowed(result); |
| 149 } | 154 } |
| OLD | NEW |