OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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::kEnableWebIntents)); | 285 switches::kDisableWebIntents)); |
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 // Skip updating intents unless it's enabled from the command line. | 438 // Don't update intents settings at this point. |
439 if (type == CONTENT_SETTINGS_TYPE_INTENTS && | 439 // Turn on when enable_web_intents_tag is enabled. |
440 !CommandLine::ForCurrentProcess()->HasSwitch( | 440 if (type == CONTENT_SETTINGS_TYPE_INTENTS) |
441 switches::kEnableWebIntents)) | |
442 return; | 441 return; |
443 | 442 |
444 switch (type) { | 443 switch (type) { |
445 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 444 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
446 UpdateGeolocationExceptionsView(); | 445 UpdateGeolocationExceptionsView(); |
447 break; | 446 break; |
448 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 447 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
449 UpdateNotificationExceptionsView(); | 448 UpdateNotificationExceptionsView(); |
450 break; | 449 break; |
451 default: | 450 default: |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); | 866 return Profile::FromWebUI(web_ui())->GetProtocolHandlerRegistry(); |
868 } | 867 } |
869 | 868 |
870 HostContentSettingsMap* | 869 HostContentSettingsMap* |
871 ContentSettingsHandler::GetOTRContentSettingsMap() { | 870 ContentSettingsHandler::GetOTRContentSettingsMap() { |
872 Profile* profile = Profile::FromWebUI(web_ui()); | 871 Profile* profile = Profile::FromWebUI(web_ui()); |
873 if (profile->HasOffTheRecordProfile()) | 872 if (profile->HasOffTheRecordProfile()) |
874 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 873 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
875 return NULL; | 874 return NULL; |
876 } | 875 } |
OLD | NEW |