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/ui/content_settings/content_setting_bubble_model.h" | 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 set_custom_link(l10n_util::GetStringUTF8( | 1192 set_custom_link(l10n_util::GetStringUTF8( |
1193 IDS_MIDI_SYSEX_BUBBLE_REQUIRE_RELOAD_TO_CLEAR)); | 1193 IDS_MIDI_SYSEX_BUBBLE_REQUIRE_RELOAD_TO_CLEAR)); |
1194 } | 1194 } |
1195 } | 1195 } |
1196 | 1196 |
1197 void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() { | 1197 void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() { |
1198 if (!web_contents()) | 1198 if (!web_contents()) |
1199 return; | 1199 return; |
1200 // Reset this embedder's entry to default for each of the requesting | 1200 // Reset this embedder's entry to default for each of the requesting |
1201 // origins currently on the page. | 1201 // origins currently on the page. |
| 1202 const GURL& embedder_url = web_contents()->GetURL(); |
1202 TabSpecificContentSettings* content_settings = | 1203 TabSpecificContentSettings* content_settings = |
1203 TabSpecificContentSettings::FromWebContents(web_contents()); | 1204 TabSpecificContentSettings::FromWebContents(web_contents()); |
1204 const ContentSettingsUsagesState::StateMap& state_map = | 1205 const ContentSettingsUsagesState::StateMap& state_map = |
1205 content_settings->midi_usages_state().state_map(); | 1206 content_settings->midi_usages_state().state_map(); |
1206 HostContentSettingsMap* settings_map = | 1207 HostContentSettingsMap* settings_map = |
1207 profile()->GetHostContentSettingsMap(); | 1208 profile()->GetHostContentSettingsMap(); |
1208 | 1209 |
1209 for (ContentSettingsUsagesState::StateMap::const_iterator it = | 1210 for (ContentSettingsUsagesState::StateMap::const_iterator it = |
1210 state_map.begin(); it != state_map.end(); ++it) { | 1211 state_map.begin(); it != state_map.end(); ++it) { |
1211 settings_map->SetContentSetting( | 1212 settings_map->SetContentSetting( |
1212 ContentSettingsPattern::FromURLNoWildcard(it->first), | 1213 ContentSettingsPattern::FromURLNoWildcard(it->first), |
1213 ContentSettingsPattern::Wildcard(), | 1214 ContentSettingsPattern::FromURLNoWildcard(embedder_url), |
1214 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, | 1215 CONTENT_SETTINGS_TYPE_MIDI_SYSEX, |
1215 std::string(), | 1216 std::string(), |
1216 CONTENT_SETTING_DEFAULT); | 1217 CONTENT_SETTING_DEFAULT); |
1217 } | 1218 } |
1218 } | 1219 } |
1219 | 1220 |
1220 // static | 1221 // static |
1221 ContentSettingBubbleModel* | 1222 ContentSettingBubbleModel* |
1222 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 1223 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
1223 Delegate* delegate, | 1224 Delegate* delegate, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1306 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
1306 DCHECK_EQ(web_contents_, | 1307 DCHECK_EQ(web_contents_, |
1307 content::Source<WebContents>(source).ptr()); | 1308 content::Source<WebContents>(source).ptr()); |
1308 web_contents_ = NULL; | 1309 web_contents_ = NULL; |
1309 } else { | 1310 } else { |
1310 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1311 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
1311 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1312 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
1312 profile_ = NULL; | 1313 profile_ = NULL; |
1313 } | 1314 } |
1314 } | 1315 } |
OLD | NEW |