| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 { "mouselock_block", IDS_MOUSE_LOCK_BLOCK_RADIO }, | 277 { "mouselock_block", IDS_MOUSE_LOCK_BLOCK_RADIO }, |
| 278 }; | 278 }; |
| 279 | 279 |
| 280 RegisterStrings(localized_strings, resources, arraysize(resources)); | 280 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 281 RegisterTitle(localized_strings, "contentSettingsPage", | 281 RegisterTitle(localized_strings, "contentSettingsPage", |
| 282 IDS_CONTENT_SETTINGS_TITLE); | 282 IDS_CONTENT_SETTINGS_TITLE); |
| 283 localized_strings->SetBoolean("enable_click_to_play", | 283 localized_strings->SetBoolean("enable_click_to_play", |
| 284 CommandLine::ForCurrentProcess()->HasSwitch( | 284 CommandLine::ForCurrentProcess()->HasSwitch( |
| 285 switches::kEnableClickToPlay)); | 285 switches::kEnableClickToPlay)); |
| 286 localized_strings->SetBoolean("enable_web_intents", | 286 localized_strings->SetBoolean("enable_web_intents", |
| 287 !CommandLine::ForCurrentProcess()->HasSwitch( | 287 CommandLine::ForCurrentProcess()->HasSwitch( |
| 288 switches::kDisableWebIntents)); | 288 switches::kEnableWebIntents)); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void ContentSettingsHandler::Initialize() { | 291 void ContentSettingsHandler::Initialize() { |
| 292 notification_registrar_.Add( | 292 notification_registrar_.Add( |
| 293 this, chrome::NOTIFICATION_PROFILE_CREATED, | 293 this, chrome::NOTIFICATION_PROFILE_CREATED, |
| 294 content::NotificationService::AllSources()); | 294 content::NotificationService::AllSources()); |
| 295 notification_registrar_.Add( | 295 notification_registrar_.Add( |
| 296 this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 296 this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
| 297 content::NotificationService::AllSources()); | 297 content::NotificationService::AllSources()); |
| 298 | 298 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 432 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
| 433 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 433 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
| 434 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 434 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
| 435 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 435 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 void ContentSettingsHandler::UpdateExceptionsViewFromModel( | 439 void ContentSettingsHandler::UpdateExceptionsViewFromModel( |
| 440 ContentSettingsType type) { | 440 ContentSettingsType type) { |
| 441 // Update intents unless it's disabled from the command line. | 441 // Skip updating intents unless it's enabled from the command line. |
| 442 if (type == CONTENT_SETTINGS_TYPE_INTENTS && | 442 if (type == CONTENT_SETTINGS_TYPE_INTENTS && |
| 443 CommandLine::ForCurrentProcess()->HasSwitch( | 443 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 444 switches::kDisableWebIntents)) | 444 switches::kEnableWebIntents)) |
| 445 return; | 445 return; |
| 446 | 446 |
| 447 switch (type) { | 447 switch (type) { |
| 448 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 448 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 449 UpdateGeolocationExceptionsView(); | 449 UpdateGeolocationExceptionsView(); |
| 450 break; | 450 break; |
| 451 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 451 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 452 UpdateNotificationExceptionsView(); | 452 UpdateNotificationExceptionsView(); |
| 453 break; | 453 break; |
| 454 default: | 454 default: |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); | 870 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); |
| 871 } | 871 } |
| 872 | 872 |
| 873 HostContentSettingsMap* | 873 HostContentSettingsMap* |
| 874 ContentSettingsHandler::GetOTRContentSettingsMap() { | 874 ContentSettingsHandler::GetOTRContentSettingsMap() { |
| 875 Profile* profile = Profile::FromWebUI(web_ui()); | 875 Profile* profile = Profile::FromWebUI(web_ui()); |
| 876 if (profile->HasOffTheRecordProfile()) | 876 if (profile->HasOffTheRecordProfile()) |
| 877 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 877 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
| 878 return NULL; | 878 return NULL; |
| 879 } | 879 } |
| OLD | NEW |