| 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"; |
| 66 case CONTENT_SETTING_BLOCK: | 68 case CONTENT_SETTING_BLOCK: |
| 67 return "block"; | 69 return "block"; |
| 68 | 70 |
| 69 default: | 71 default: |
| 70 NOTREACHED(); | 72 NOTREACHED(); |
| 71 return ""; | 73 return ""; |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 | 76 |
| 75 ContentSetting ContentSettingFromString(const std::string& name) { | 77 ContentSetting ContentSettingFromString(const std::string& name) { |
| 76 if (name == "allow") | 78 if (name == "allow") |
| 77 return CONTENT_SETTING_ALLOW; | 79 return CONTENT_SETTING_ALLOW; |
| 80 if (name == "ask") |
| 81 return CONTENT_SETTING_ASK; |
| 78 if (name == "block") | 82 if (name == "block") |
| 79 return CONTENT_SETTING_BLOCK; | 83 return CONTENT_SETTING_BLOCK; |
| 80 | 84 |
| 81 NOTREACHED(); | 85 NOTREACHED(); |
| 82 return CONTENT_SETTING_DEFAULT; | 86 return CONTENT_SETTING_DEFAULT; |
| 83 } | 87 } |
| 84 | 88 |
| 85 } // namespace | 89 } // namespace |
| 86 | 90 |
| 87 ContentSettingsHandler::ContentSettingsHandler() { | 91 ContentSettingsHandler::ContentSettingsHandler() { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 ContentSettingsTypeFromGroupName(group), | 243 ContentSettingsTypeFromGroupName(group), |
| 240 ContentSettingFromString(setting)); | 244 ContentSettingFromString(setting)); |
| 241 } | 245 } |
| 242 | 246 |
| 243 void ContentSettingsHandler::SetAllowThirdPartyCookies(const Value* value) { | 247 void ContentSettingsHandler::SetAllowThirdPartyCookies(const Value* value) { |
| 244 std::wstring allow = ExtractStringValue(value); | 248 std::wstring allow = ExtractStringValue(value); |
| 245 | 249 |
| 246 dom_ui_->GetProfile()->GetHostContentSettingsMap()->SetBlockThirdPartyCookies( | 250 dom_ui_->GetProfile()->GetHostContentSettingsMap()->SetBlockThirdPartyCookies( |
| 247 allow == L"true"); | 251 allow == L"true"); |
| 248 } | 252 } |
| OLD | NEW |