OLD | NEW |
1 // Copyright (c) 2012 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/options2/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options2/content_settings_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 IDS_MOUSE_LOCK_TAB_LABEL); | 469 IDS_MOUSE_LOCK_TAB_LABEL); |
470 RegisterTitle(localized_strings, "pepper-flash-cameramic", | 470 RegisterTitle(localized_strings, "pepper-flash-cameramic", |
471 IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL); | 471 IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL); |
472 RegisterTitle(localized_strings, "media-stream", | 472 RegisterTitle(localized_strings, "media-stream", |
473 IDS_MEDIA_STREAM_TAB_LABEL); | 473 IDS_MEDIA_STREAM_TAB_LABEL); |
474 | 474 |
475 Profile* profile = Profile::FromWebUI(web_ui()); | 475 Profile* profile = Profile::FromWebUI(web_ui()); |
476 localized_strings->SetBoolean( | 476 localized_strings->SetBoolean( |
477 "enable_web_intents", | 477 "enable_web_intents", |
478 web_intents::IsWebIntentsEnabledForProfile(profile)); | 478 web_intents::IsWebIntentsEnabledForProfile(profile)); |
479 // TODO(marja): clean up the options UI after the decision on the session | |
480 // restore changes has stabilized. | |
481 localized_strings->SetBoolean( | |
482 "enable_restore_session_state", false); | |
483 } | 479 } |
484 | 480 |
485 void ContentSettingsHandler::InitializeHandler() { | 481 void ContentSettingsHandler::InitializeHandler() { |
486 notification_registrar_.Add( | 482 notification_registrar_.Add( |
487 this, chrome::NOTIFICATION_PROFILE_CREATED, | 483 this, chrome::NOTIFICATION_PROFILE_CREATED, |
488 content::NotificationService::AllSources()); | 484 content::NotificationService::AllSources()); |
489 notification_registrar_.Add( | 485 notification_registrar_.Add( |
490 this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 486 this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
491 content::NotificationService::AllSources()); | 487 content::NotificationService::AllSources()); |
492 | 488 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 DictionaryValue filter_settings; | 609 DictionaryValue filter_settings; |
614 std::string provider_id; | 610 std::string provider_id; |
615 filter_settings.SetString( | 611 filter_settings.SetString( |
616 ExContentSettingsTypeToGroupName(type) + ".value", | 612 ExContentSettingsTypeToGroupName(type) + ".value", |
617 GetSettingDefaultFromModel(type, &provider_id)); | 613 GetSettingDefaultFromModel(type, &provider_id)); |
618 filter_settings.SetString( | 614 filter_settings.SetString( |
619 ExContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); | 615 ExContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); |
620 | 616 |
621 web_ui()->CallJavascriptFunction( | 617 web_ui()->CallJavascriptFunction( |
622 "ContentSettings.setContentFilterSettingsValue", filter_settings); | 618 "ContentSettings.setContentFilterSettingsValue", filter_settings); |
623 web_ui()->CallJavascriptFunction( | |
624 "BrowserOptions.setContentFilterSettingsValue", filter_settings); | |
625 } | 619 } |
626 | 620 |
627 std::string ContentSettingsHandler::GetSettingDefaultFromModel( | 621 std::string ContentSettingsHandler::GetSettingDefaultFromModel( |
628 const ExContentSettingsType& type, std::string* provider_id) { | 622 const ExContentSettingsType& type, std::string* provider_id) { |
629 Profile* profile = Profile::FromWebUI(web_ui()); | 623 Profile* profile = Profile::FromWebUI(web_ui()); |
630 ContentSetting default_setting; | 624 ContentSetting default_setting; |
631 if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { | 625 if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
632 default_setting = | 626 default_setting = |
633 DesktopNotificationServiceFactory::GetForProfile(profile)-> | 627 DesktopNotificationServiceFactory::GetForProfile(profile)-> |
634 GetDefaultContentSetting(provider_id); | 628 GetDefaultContentSetting(provider_id); |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { | 1323 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { |
1330 if (type == kExContentSettingsTypeGroupNames[i].type) | 1324 if (type == kExContentSettingsTypeGroupNames[i].type) |
1331 return kExContentSettingsTypeGroupNames[i].name; | 1325 return kExContentSettingsTypeGroupNames[i].name; |
1332 } | 1326 } |
1333 | 1327 |
1334 NOTREACHED(); | 1328 NOTREACHED(); |
1335 return std::string(); | 1329 return std::string(); |
1336 } | 1330 } |
1337 | 1331 |
1338 } // namespace options2 | 1332 } // namespace options2 |
OLD | NEW |