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/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/plugins/plugin_finder.h" | 10 #include "chrome/browser/plugins/plugin_finder.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ContentSetting setting = | 48 ContentSetting setting = |
49 content_settings->GetContentSetting(url, url, | 49 content_settings->GetContentSetting(url, url, |
50 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 50 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
51 std::string()); | 51 std::string()); |
52 | 52 |
53 if (setting == CONTENT_SETTING_ASK) { | 53 if (setting == CONTENT_SETTING_ASK) { |
54 content::RecordAction( | 54 content::RecordAction( |
55 base::UserMetricsAction("PPAPI.BrokerInfobarDisplayed")); | 55 base::UserMetricsAction("PPAPI.BrokerInfobarDisplayed")); |
56 InfoBarService* infobar_service = | 56 InfoBarService* infobar_service = |
57 InfoBarService::FromWebContents(web_contents); | 57 InfoBarService::FromWebContents(web_contents); |
58 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 58 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
59 scoped_ptr<ConfirmInfoBarDelegate>(new PepperBrokerInfoBarDelegate( | 59 scoped_ptr<ConfirmInfoBarDelegate>(new PepperBrokerInfoBarDelegate( |
60 url, plugin_path, | 60 url, plugin_path, |
61 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), | 61 profile->GetPrefs()->GetString(prefs::kAcceptLanguages), |
62 content_settings, tab_content_settings, callback)))); | 62 content_settings, tab_content_settings, callback)))); |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 bool allowed = (setting == CONTENT_SETTING_ALLOW); | 66 bool allowed = (setting == CONTENT_SETTING_ALLOW); |
67 content::RecordAction(allowed ? | 67 content::RecordAction(allowed ? |
68 base::UserMetricsAction("PPAPI.BrokerSettingAllow") : | 68 base::UserMetricsAction("PPAPI.BrokerSettingAllow") : |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); | 147 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); |
148 callback_.Run(result); | 148 callback_.Run(result); |
149 callback_ = base::Callback<void(bool)>(); | 149 callback_ = base::Callback<void(bool)>(); |
150 content_settings_->SetContentSetting( | 150 content_settings_->SetContentSetting( |
151 ContentSettingsPattern::FromURLNoWildcard(url_), | 151 ContentSettingsPattern::FromURLNoWildcard(url_), |
152 ContentSettingsPattern::Wildcard(), | 152 ContentSettingsPattern::Wildcard(), |
153 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 153 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
154 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 154 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
155 tab_content_settings_->SetPepperBrokerAllowed(result); | 155 tab_content_settings_->SetPepperBrokerAllowed(result); |
156 } | 156 } |
OLD | NEW |