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/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 prefs::kVideoCaptureAllowed, | 475 prefs::kVideoCaptureAllowed, |
476 base::Bind(&ContentSettingsHandler::UpdateMediaSettingsView, | 476 base::Bind(&ContentSettingsHandler::UpdateMediaSettingsView, |
477 base::Unretained(this))); | 477 base::Unretained(this))); |
478 pref_change_registrar_.Add( | 478 pref_change_registrar_.Add( |
479 prefs::kEnableDRM, | 479 prefs::kEnableDRM, |
480 base::Bind( | 480 base::Bind( |
481 &ContentSettingsHandler::UpdateProtectedContentExceptionsButton, | 481 &ContentSettingsHandler::UpdateProtectedContentExceptionsButton, |
482 base::Unretained(this))); | 482 base::Unretained(this))); |
483 | 483 |
484 content::HostZoomMap* host_zoom_map = | 484 content::HostZoomMap* host_zoom_map = |
485 content::HostZoomMap::GetForBrowserContext(context); | 485 content::HostZoomMap::GetDefaultForBrowserContext(context); |
486 host_zoom_map_subscription_ = | 486 host_zoom_map_subscription_ = |
487 host_zoom_map->AddZoomLevelChangedCallback( | 487 host_zoom_map->AddZoomLevelChangedCallback( |
488 base::Bind(&ContentSettingsHandler::OnZoomLevelChanged, | 488 base::Bind(&ContentSettingsHandler::OnZoomLevelChanged, |
489 base::Unretained(this))); | 489 base::Unretained(this))); |
490 | 490 |
491 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, context)); | 491 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, context)); |
492 observer_.Add(Profile::FromWebUI(web_ui())->GetHostContentSettingsMap()); | 492 observer_.Add(Profile::FromWebUI(web_ui())->GetHostContentSettingsMap()); |
493 } | 493 } |
494 | 494 |
495 void ContentSettingsHandler::InitializePage() { | 495 void ContentSettingsHandler::InitializePage() { |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 954 |
955 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 955 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
956 UpdateExceptionsViewFromHostContentSettingsMap( | 956 UpdateExceptionsViewFromHostContentSettingsMap( |
957 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); | 957 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); |
958 } | 958 } |
959 | 959 |
960 void ContentSettingsHandler::UpdateZoomLevelsExceptionsView() { | 960 void ContentSettingsHandler::UpdateZoomLevelsExceptionsView() { |
961 base::ListValue zoom_levels_exceptions; | 961 base::ListValue zoom_levels_exceptions; |
962 | 962 |
963 content::HostZoomMap* host_zoom_map = | 963 content::HostZoomMap* host_zoom_map = |
964 content::HostZoomMap::GetForBrowserContext(GetBrowserContext(web_ui())); | 964 content::HostZoomMap::GetDefaultForBrowserContext( |
| 965 GetBrowserContext(web_ui())); |
965 content::HostZoomMap::ZoomLevelVector zoom_levels( | 966 content::HostZoomMap::ZoomLevelVector zoom_levels( |
966 host_zoom_map->GetAllZoomLevels()); | 967 host_zoom_map->GetAllZoomLevels()); |
967 std::sort(zoom_levels.begin(), zoom_levels.end(), HostZoomSort); | 968 std::sort(zoom_levels.begin(), zoom_levels.end(), HostZoomSort); |
968 | 969 |
969 for (content::HostZoomMap::ZoomLevelVector::const_iterator i = | 970 for (content::HostZoomMap::ZoomLevelVector::const_iterator i = |
970 zoom_levels.begin(); | 971 zoom_levels.begin(); |
971 i != zoom_levels.end(); | 972 i != zoom_levels.end(); |
972 ++i) { | 973 ++i) { |
973 scoped_ptr<base::DictionaryValue> exception(new base::DictionaryValue); | 974 scoped_ptr<base::DictionaryValue> exception(new base::DictionaryValue); |
974 switch (i->mode) { | 975 switch (i->mode) { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 const base::ListValue* args) { | 1208 const base::ListValue* args) { |
1208 std::string mode; | 1209 std::string mode; |
1209 bool rv = args->GetString(1, &mode); | 1210 bool rv = args->GetString(1, &mode); |
1210 DCHECK(rv); | 1211 DCHECK(rv); |
1211 | 1212 |
1212 std::string pattern; | 1213 std::string pattern; |
1213 rv = args->GetString(2, &pattern); | 1214 rv = args->GetString(2, &pattern); |
1214 DCHECK(rv); | 1215 DCHECK(rv); |
1215 | 1216 |
1216 content::HostZoomMap* host_zoom_map = | 1217 content::HostZoomMap* host_zoom_map = |
1217 content::HostZoomMap::GetForBrowserContext(GetBrowserContext(web_ui())); | 1218 content::HostZoomMap::GetDefaultForBrowserContext( |
| 1219 GetBrowserContext(web_ui())); |
1218 double default_level = host_zoom_map->GetDefaultZoomLevel(); | 1220 double default_level = host_zoom_map->GetDefaultZoomLevel(); |
1219 host_zoom_map->SetZoomLevelForHost(pattern, default_level); | 1221 host_zoom_map->SetZoomLevelForHost(pattern, default_level); |
1220 } | 1222 } |
1221 | 1223 |
1222 void ContentSettingsHandler::RegisterMessages() { | 1224 void ContentSettingsHandler::RegisterMessages() { |
1223 web_ui()->RegisterMessageCallback("setContentFilter", | 1225 web_ui()->RegisterMessageCallback("setContentFilter", |
1224 base::Bind(&ContentSettingsHandler::SetContentFilter, | 1226 base::Bind(&ContentSettingsHandler::SetContentFilter, |
1225 base::Unretained(this))); | 1227 base::Unretained(this))); |
1226 web_ui()->RegisterMessageCallback("removeException", | 1228 web_ui()->RegisterMessageCallback("removeException", |
1227 base::Bind(&ContentSettingsHandler::RemoveException, | 1229 base::Bind(&ContentSettingsHandler::RemoveException, |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { | 1538 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { |
1537 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1539 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1538 // Exceptions apply only when the feature is enabled. | 1540 // Exceptions apply only when the feature is enabled. |
1539 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1541 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1540 web_ui()->CallJavascriptFunction( | 1542 web_ui()->CallJavascriptFunction( |
1541 "ContentSettings.enableProtectedContentExceptions", | 1543 "ContentSettings.enableProtectedContentExceptions", |
1542 base::FundamentalValue(enable_exceptions)); | 1544 base::FundamentalValue(enable_exceptions)); |
1543 } | 1545 } |
1544 | 1546 |
1545 } // namespace options | 1547 } // namespace options |
OLD | NEW |