| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 void ContentSettingsHandler::Initialize() { | 203 void ContentSettingsHandler::Initialize() { |
| 204 UpdateAllExceptionsDefaultsFromModel(); | 204 UpdateAllExceptionsDefaultsFromModel(); |
| 205 | 205 |
| 206 const HostContentSettingsMap* settings_map = | 206 const HostContentSettingsMap* settings_map = |
| 207 dom_ui_->GetProfile()->GetHostContentSettingsMap(); | 207 dom_ui_->GetProfile()->GetHostContentSettingsMap(); |
| 208 scoped_ptr<Value> block_3rd_party(Value::CreateBooleanValue( | 208 scoped_ptr<Value> block_3rd_party(Value::CreateBooleanValue( |
| 209 settings_map->BlockThirdPartyCookies())); | 209 settings_map->BlockThirdPartyCookies())); |
| 210 dom_ui_->CallJavascriptFunction( | 210 dom_ui_->CallJavascriptFunction( |
| 211 L"ContentSettings.setBlockThirdPartyCookies", *block_3rd_party.get()); | 211 L"ContentSettings.setBlockThirdPartyCookies", *block_3rd_party.get()); |
| 212 | 212 |
| 213 scoped_ptr<Value> show_cookies_prompt(Value::CreateBooleanValue( | |
| 214 CommandLine::ForCurrentProcess()->HasSwitch( | |
| 215 switches::kEnableCookiePrompt))); | |
| 216 dom_ui_->CallJavascriptFunction( | |
| 217 L"ContentSettings.setCookiesPromptEnabled", *show_cookies_prompt.get()); | |
| 218 | |
| 219 UpdateAllExceptionsViewsFromModel(); | 213 UpdateAllExceptionsViewsFromModel(); |
| 220 notification_registrar_.Add( | 214 notification_registrar_.Add( |
| 221 this, NotificationType::CONTENT_SETTINGS_CHANGED, | 215 this, NotificationType::CONTENT_SETTINGS_CHANGED, |
| 222 Source<const HostContentSettingsMap>(settings_map)); | 216 Source<const HostContentSettingsMap>(settings_map)); |
| 223 } | 217 } |
| 224 | 218 |
| 225 void ContentSettingsHandler::Observe(NotificationType type, | 219 void ContentSettingsHandler::Observe(NotificationType type, |
| 226 const NotificationSource& source, | 220 const NotificationSource& source, |
| 227 const NotificationDetails& details) { | 221 const NotificationDetails& details) { |
| 228 if (type != NotificationType::CONTENT_SETTINGS_CHANGED) | 222 if (type != NotificationType::CONTENT_SETTINGS_CHANGED) |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 475 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 482 return "location"; | 476 return "location"; |
| 483 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 477 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 484 return "notifications"; | 478 return "notifications"; |
| 485 | 479 |
| 486 default: | 480 default: |
| 487 NOTREACHED(); | 481 NOTREACHED(); |
| 488 return ""; | 482 return ""; |
| 489 } | 483 } |
| 490 } | 484 } |
| OLD | NEW |