| 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/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/plugins/plugin_finder.h" | 11 #include "chrome/browser/plugins/plugin_finder.h" |
| 11 #include "chrome/browser/plugins/plugin_metadata.h" | 12 #include "chrome/browser/plugins/plugin_metadata.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/content_settings/core/browser/host_content_settings_map.h" | 16 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 16 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
| 17 #include "components/url_formatter/url_formatter.h" | 18 #include "components/url_formatter/url_formatter.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 37 // TODO(wad): Add ephemeral device ID support for broker in guest mode. | 38 // TODO(wad): Add ephemeral device ID support for broker in guest mode. |
| 38 if (profile->IsGuestSession()) { | 39 if (profile->IsGuestSession()) { |
| 39 callback.Run(false); | 40 callback.Run(false); |
| 40 return; | 41 return; |
| 41 } | 42 } |
| 42 | 43 |
| 43 TabSpecificContentSettings* tab_content_settings = | 44 TabSpecificContentSettings* tab_content_settings = |
| 44 TabSpecificContentSettings::FromWebContents(web_contents); | 45 TabSpecificContentSettings::FromWebContents(web_contents); |
| 45 | 46 |
| 46 HostContentSettingsMap* content_settings = | 47 HostContentSettingsMap* content_settings = |
| 47 profile->GetHostContentSettingsMap(); | 48 HostContentSettingsMapFactory::GetForProfile(profile); |
| 48 ContentSetting setting = | 49 ContentSetting setting = |
| 49 content_settings->GetContentSetting(url, url, | 50 content_settings->GetContentSetting(url, url, |
| 50 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 51 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
| 51 std::string()); | 52 std::string()); |
| 52 | 53 |
| 53 if (setting == CONTENT_SETTING_ASK) { | 54 if (setting == CONTENT_SETTING_ASK) { |
| 54 content::RecordAction( | 55 content::RecordAction( |
| 55 base::UserMetricsAction("PPAPI.BrokerInfobarDisplayed")); | 56 base::UserMetricsAction("PPAPI.BrokerInfobarDisplayed")); |
| 56 InfoBarService* infobar_service = | 57 InfoBarService* infobar_service = |
| 57 InfoBarService::FromWebContents(web_contents); | 58 InfoBarService::FromWebContents(web_contents); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); | 147 base::UserMetricsAction("PPAPI.BrokerInfobarClickedDeny")); |
| 147 callback_.Run(result); | 148 callback_.Run(result); |
| 148 callback_ = base::Callback<void(bool)>(); | 149 callback_ = base::Callback<void(bool)>(); |
| 149 content_settings_->SetContentSetting( | 150 content_settings_->SetContentSetting( |
| 150 ContentSettingsPattern::FromURLNoWildcard(url_), | 151 ContentSettingsPattern::FromURLNoWildcard(url_), |
| 151 ContentSettingsPattern::Wildcard(), | 152 ContentSettingsPattern::Wildcard(), |
| 152 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 153 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
| 153 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 154 std::string(), result ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
| 154 tab_content_settings_->SetPepperBrokerAllowed(result); | 155 tab_content_settings_->SetPepperBrokerAllowed(result); |
| 155 } | 156 } |
| OLD | NEW |