| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/content_settings_handler.h" | 5 #include "chrome/browser/dom_ui/content_settings_handler.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; | 56 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| 57 | 57 |
| 58 NOTREACHED(); | 58 NOTREACHED(); |
| 59 return CONTENT_SETTINGS_TYPE_DEFAULT; | 59 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 60 } | 60 } |
| 61 | 61 |
| 62 std::string ContentSettingToString(ContentSetting setting) { | 62 std::string ContentSettingToString(ContentSetting setting) { |
| 63 switch (setting) { | 63 switch (setting) { |
| 64 case CONTENT_SETTING_ALLOW: | 64 case CONTENT_SETTING_ALLOW: |
| 65 return "allow"; | 65 return "allow"; |
| 66 case CONTENT_SETTING_ASK: | |
| 67 return "ask"; | |
| 68 case CONTENT_SETTING_BLOCK: | 66 case CONTENT_SETTING_BLOCK: |
| 69 return "block"; | 67 return "block"; |
| 70 | 68 |
| 71 default: | 69 default: |
| 72 NOTREACHED(); | 70 NOTREACHED(); |
| 73 return ""; | 71 return ""; |
| 74 } | 72 } |
| 75 } | 73 } |
| 76 | 74 |
| 77 ContentSetting ContentSettingFromString(const std::string& name) { | 75 ContentSetting ContentSettingFromString(const std::string& name) { |
| 78 if (name == "allow") | 76 if (name == "allow") |
| 79 return CONTENT_SETTING_ALLOW; | 77 return CONTENT_SETTING_ALLOW; |
| 80 if (name == "ask") | |
| 81 return CONTENT_SETTING_ASK; | |
| 82 if (name == "block") | 78 if (name == "block") |
| 83 return CONTENT_SETTING_BLOCK; | 79 return CONTENT_SETTING_BLOCK; |
| 84 | 80 |
| 85 NOTREACHED(); | 81 NOTREACHED(); |
| 86 return CONTENT_SETTING_DEFAULT; | 82 return CONTENT_SETTING_DEFAULT; |
| 87 } | 83 } |
| 88 | 84 |
| 89 } // namespace | 85 } // namespace |
| 90 | 86 |
| 91 ContentSettingsHandler::ContentSettingsHandler() { | 87 ContentSettingsHandler::ContentSettingsHandler() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 localized_strings->SetString(L"contentSettingsPage", | 99 localized_strings->SetString(L"contentSettingsPage", |
| 104 l10n_util::GetString(IDS_CONTENT_SETTINGS_TITLE)); | 100 l10n_util::GetString(IDS_CONTENT_SETTINGS_TITLE)); |
| 105 | 101 |
| 106 // Cookies filter. | 102 // Cookies filter. |
| 107 localized_strings->SetString(L"cookies_tab_label", | 103 localized_strings->SetString(L"cookies_tab_label", |
| 108 l10n_util::GetString(IDS_COOKIES_TAB_LABEL)); | 104 l10n_util::GetString(IDS_COOKIES_TAB_LABEL)); |
| 109 localized_strings->SetString(L"cookies_modify", | 105 localized_strings->SetString(L"cookies_modify", |
| 110 l10n_util::GetString(IDS_MODIFY_COOKIE_STORING_LABEL)); | 106 l10n_util::GetString(IDS_MODIFY_COOKIE_STORING_LABEL)); |
| 111 localized_strings->SetString(L"cookies_allow", | 107 localized_strings->SetString(L"cookies_allow", |
| 112 l10n_util::GetString(IDS_COOKIES_ALLOW_RADIO)); | 108 l10n_util::GetString(IDS_COOKIES_ALLOW_RADIO)); |
| 113 localized_strings->SetString(L"cookies_ask", | |
| 114 l10n_util::GetString(IDS_COOKIES_ASK_EVERY_TIME_RADIO)); | |
| 115 localized_strings->SetString(L"cookies_block", | 109 localized_strings->SetString(L"cookies_block", |
| 116 l10n_util::GetString(IDS_COOKIES_BLOCK_RADIO)); | 110 l10n_util::GetString(IDS_COOKIES_BLOCK_RADIO)); |
| 117 localized_strings->SetString(L"cookies_block_3rd_party", | 111 localized_strings->SetString(L"cookies_block_3rd_party", |
| 118 l10n_util::GetString(IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX)); | 112 l10n_util::GetString(IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX)); |
| 119 localized_strings->SetString(L"cookies_clear_on_exit", | 113 localized_strings->SetString(L"cookies_clear_on_exit", |
| 120 l10n_util::GetString(IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX)); | 114 l10n_util::GetString(IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX)); |
| 121 localized_strings->SetString(L"cookies_show_cookies", | 115 localized_strings->SetString(L"cookies_show_cookies", |
| 122 l10n_util::GetString(IDS_COOKIES_SHOW_COOKIES_BUTTON)); | 116 l10n_util::GetString(IDS_COOKIES_SHOW_COOKIES_BUTTON)); |
| 123 localized_strings->SetString(L"flash_storage_settings", | 117 localized_strings->SetString(L"flash_storage_settings", |
| 124 l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS)); | 118 l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 ContentSettingsTypeFromGroupName(group), | 239 ContentSettingsTypeFromGroupName(group), |
| 246 ContentSettingFromString(setting)); | 240 ContentSettingFromString(setting)); |
| 247 } | 241 } |
| 248 | 242 |
| 249 void ContentSettingsHandler::SetAllowThirdPartyCookies(const Value* value) { | 243 void ContentSettingsHandler::SetAllowThirdPartyCookies(const Value* value) { |
| 250 std::wstring allow = ExtractStringValue(value); | 244 std::wstring allow = ExtractStringValue(value); |
| 251 | 245 |
| 252 dom_ui_->GetProfile()->GetHostContentSettingsMap()->SetBlockThirdPartyCookies( | 246 dom_ui_->GetProfile()->GetHostContentSettingsMap()->SetBlockThirdPartyCookies( |
| 253 allow == L"true"); | 247 allow == L"true"); |
| 254 } | 248 } |
| OLD | NEW |