| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 GetProtocolHandlerRegistry()->enabled()); | 392 GetProtocolHandlerRegistry()->enabled()); |
| 393 | 393 |
| 394 web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios", | 394 web_ui_->CallJavascriptFunction("ContentSettings.updateHandlersEnabledRadios", |
| 395 handlers_enabled); | 395 handlers_enabled); |
| 396 #endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER) | 396 #endif // defined(ENABLE_REGISTER_PROTOCOL_HANDLER) |
| 397 } | 397 } |
| 398 | 398 |
| 399 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { | 399 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { |
| 400 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 400 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
| 401 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 401 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| 402 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
| 403 // is supposed to be set by policy only. Hence there is no user facing UI |
| 404 // for this content type and we skip it here. |
| 405 if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE) |
| 406 continue; |
| 402 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 407 UpdateExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
| 403 } | 408 } |
| 404 } | 409 } |
| 405 | 410 |
| 406 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 411 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
| 407 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 412 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
| 408 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 413 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| 409 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 414 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
| 410 } | 415 } |
| 411 } | 416 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 Profile* profile = Profile::FromWebUI(web_ui_); | 626 Profile* profile = Profile::FromWebUI(web_ui_); |
| 622 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); | 627 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); |
| 623 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { | 628 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { |
| 624 std::string origin; | 629 std::string origin; |
| 625 std::string embedding_origin; | 630 std::string embedding_origin; |
| 626 bool rv = args->GetString(arg_i++, &origin); | 631 bool rv = args->GetString(arg_i++, &origin); |
| 627 DCHECK(rv); | 632 DCHECK(rv); |
| 628 rv = args->GetString(arg_i++, &embedding_origin); | 633 rv = args->GetString(arg_i++, &embedding_origin); |
| 629 DCHECK(rv); | 634 DCHECK(rv); |
| 630 | 635 |
| 631 profile->GetHostContentSettingsMap()-> | 636 profile->GetHostContentSettingsMap()-> |
| 632 SetContentSetting(ContentSettingsPattern::FromString(origin), | 637 SetContentSetting(ContentSettingsPattern::FromString(origin), |
| 633 ContentSettingsPattern::FromString(embedding_origin), | 638 ContentSettingsPattern::FromString(embedding_origin), |
| 634 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 639 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 635 std::string(), | 640 std::string(), |
| 636 CONTENT_SETTING_DEFAULT); | 641 CONTENT_SETTING_DEFAULT); |
| 637 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { | 642 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
| 638 std::string origin; | 643 std::string origin; |
| 639 std::string setting; | 644 std::string setting; |
| 640 bool rv = args->GetString(arg_i++, &origin); | 645 bool rv = args->GetString(arg_i++, &origin); |
| 641 DCHECK(rv); | 646 DCHECK(rv); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 758 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
| 754 } | 759 } |
| 755 | 760 |
| 756 HostContentSettingsMap* | 761 HostContentSettingsMap* |
| 757 ContentSettingsHandler::GetOTRContentSettingsMap() { | 762 ContentSettingsHandler::GetOTRContentSettingsMap() { |
| 758 Profile* profile = Profile::FromWebUI(web_ui_); | 763 Profile* profile = Profile::FromWebUI(web_ui_); |
| 759 if (profile->HasOffTheRecordProfile()) | 764 if (profile->HasOffTheRecordProfile()) |
| 760 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 765 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
| 761 return NULL; | 766 return NULL; |
| 762 } | 767 } |
| OLD | NEW |