OLD | NEW |
1 // Copyright (c) 2012 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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 { "mouselock_header", IDS_MOUSE_LOCK_HEADER }, | 274 { "mouselock_header", IDS_MOUSE_LOCK_HEADER }, |
275 { "mouselock_allow", IDS_MOUSE_LOCK_ALLOW_RADIO }, | 275 { "mouselock_allow", IDS_MOUSE_LOCK_ALLOW_RADIO }, |
276 { "mouselock_ask", IDS_MOUSE_LOCK_ASK_RADIO }, | 276 { "mouselock_ask", IDS_MOUSE_LOCK_ASK_RADIO }, |
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_web_intents", | 283 localized_strings->SetBoolean("enable_web_intents", |
284 !CommandLine::ForCurrentProcess()->HasSwitch( | 284 CommandLine::ForCurrentProcess()->HasSwitch( |
285 switches::kDisableWebIntents)); | 285 switches::kEnableWebIntents)); |
286 } | 286 } |
287 | 287 |
288 void ContentSettingsHandler::Initialize() { | 288 void ContentSettingsHandler::Initialize() { |
289 notification_registrar_.Add( | 289 notification_registrar_.Add( |
290 this, chrome::NOTIFICATION_PROFILE_CREATED, | 290 this, chrome::NOTIFICATION_PROFILE_CREATED, |
291 content::NotificationService::AllSources()); | 291 content::NotificationService::AllSources()); |
292 notification_registrar_.Add( | 292 notification_registrar_.Add( |
293 this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 293 this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
294 content::NotificationService::AllSources()); | 294 content::NotificationService::AllSources()); |
295 | 295 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 428 |
429 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { | 429 void ContentSettingsHandler::UpdateAllOTRExceptionsViewsFromModel() { |
430 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; | 430 for (int type = CONTENT_SETTINGS_TYPE_DEFAULT + 1; |
431 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { | 431 type < CONTENT_SETTINGS_NUM_TYPES; ++type) { |
432 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); | 432 UpdateOTRExceptionsViewFromModel(static_cast<ContentSettingsType>(type)); |
433 } | 433 } |
434 } | 434 } |
435 | 435 |
436 void ContentSettingsHandler::UpdateExceptionsViewFromModel( | 436 void ContentSettingsHandler::UpdateExceptionsViewFromModel( |
437 ContentSettingsType type) { | 437 ContentSettingsType type) { |
438 // Don't update intents settings at this point. | 438 // Skip updating intents unless it's enabled from the command line. |
439 // Turn on when enable_web_intents_tag is enabled. | 439 if (type == CONTENT_SETTINGS_TYPE_INTENTS && |
440 if (type == CONTENT_SETTINGS_TYPE_INTENTS) | 440 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 441 switches::kEnableWebIntents)) |
441 return; | 442 return; |
442 | 443 |
443 switch (type) { | 444 switch (type) { |
444 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 445 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
445 UpdateGeolocationExceptionsView(); | 446 UpdateGeolocationExceptionsView(); |
446 break; | 447 break; |
447 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 448 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
448 UpdateNotificationExceptionsView(); | 449 UpdateNotificationExceptionsView(); |
449 break; | 450 break; |
450 default: | 451 default: |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); | 867 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); |
867 } | 868 } |
868 | 869 |
869 HostContentSettingsMap* | 870 HostContentSettingsMap* |
870 ContentSettingsHandler::GetOTRContentSettingsMap() { | 871 ContentSettingsHandler::GetOTRContentSettingsMap() { |
871 Profile* profile = Profile::FromWebUI(web_ui()); | 872 Profile* profile = Profile::FromWebUI(web_ui()); |
872 if (profile->HasOffTheRecordProfile()) | 873 if (profile->HasOffTheRecordProfile()) |
873 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 874 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
874 return NULL; | 875 return NULL; |
875 } | 876 } |
OLD | NEW |