Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 22 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/content_settings.h" | 27 #include "chrome/common/content_settings.h" |
| 28 #include "chrome/common/content_settings_pattern.h" | 28 #include "chrome/common/content_settings_pattern.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 31 #include "content/browser/tab_contents/tab_contents.h" | 31 #include "content/browser/tab_contents/tab_contents.h" |
| 32 #include "content/browser/user_metrics.h" | |
| 32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
| 34 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
| 36 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 37 #include "grit/locale_settings.h" | 38 #include "grit/locale_settings.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 ContentSetting default_setting = ContentSettingFromString(setting); | 682 ContentSetting default_setting = ContentSettingFromString(setting); |
| 682 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); | 683 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); |
| 683 if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { | 684 if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
| 684 Profile* profile = Profile::FromWebUI(web_ui_); | 685 Profile* profile = Profile::FromWebUI(web_ui_); |
| 685 DesktopNotificationServiceFactory::GetForProfile(profile)-> | 686 DesktopNotificationServiceFactory::GetForProfile(profile)-> |
| 686 SetDefaultContentSetting(default_setting); | 687 SetDefaultContentSetting(default_setting); |
| 687 } else { | 688 } else { |
| 688 GetContentSettingsMap()-> | 689 GetContentSettingsMap()-> |
| 689 SetDefaultContentSetting(content_type, default_setting); | 690 SetDefaultContentSetting(content_type, default_setting); |
| 690 } | 691 } |
| 692 switch (content_type) { | |
| 693 case CONTENT_SETTINGS_TYPE_COOKIES: | |
| 694 UserMetrics::RecordAction( | |
| 695 UserMetricsAction("DefaultCookieSettingChanged")); | |
|
Patrick Dubroy
2011/11/28 14:42:30
Maybe name these something like "DefaultSettings_C
markusheintz_
2011/11/28 15:18:41
I chose the
ContentSetting_Default<ContentSettings
| |
| 696 break; | |
| 697 case CONTENT_SETTINGS_TYPE_IMAGES: | |
| 698 UserMetrics::RecordAction( | |
| 699 UserMetricsAction("DefaultImagesSettingChanged")); | |
| 700 break; | |
| 701 case CONTENT_SETTINGS_TYPE_JAVASCRIPT: | |
| 702 UserMetrics::RecordAction( | |
| 703 UserMetricsAction("DefaultJavaScriptSettingChanged")); | |
| 704 break; | |
| 705 case CONTENT_SETTINGS_TYPE_PLUGINS: | |
| 706 UserMetrics::RecordAction( | |
| 707 UserMetricsAction("DefaultPluginsSettingChanged")); | |
| 708 break; | |
| 709 case CONTENT_SETTINGS_TYPE_POPUPS: | |
| 710 UserMetrics::RecordAction( | |
| 711 UserMetricsAction("DefaultPopupsSettingChanged")); | |
| 712 break; | |
| 713 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | |
| 714 UserMetrics::RecordAction( | |
| 715 UserMetricsAction("DefaultNotificationsSettingChanged")); | |
| 716 break; | |
| 717 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | |
| 718 UserMetrics::RecordAction( | |
| 719 UserMetricsAction("DefaultGeolocationSettingChanged")); | |
| 720 break; | |
| 721 case CONTENT_SETTINGS_TYPE_INTENTS: | |
| 722 UserMetrics::RecordAction( | |
| 723 UserMetricsAction("DefaultHandlersSettingChanged")); | |
| 724 break; | |
|
battre
2011/11/28 14:17:10
I noticed that several content setting types don't
markusheintz_
2011/11/28 15:18:41
Auto_select_certificate and fullscreen have no def
| |
| 725 default: | |
| 726 break; | |
| 727 } | |
| 691 } | 728 } |
| 692 | 729 |
| 693 void ContentSettingsHandler::RemoveException(const ListValue* args) { | 730 void ContentSettingsHandler::RemoveException(const ListValue* args) { |
| 694 size_t arg_i = 0; | 731 size_t arg_i = 0; |
| 695 std::string type_string; | 732 std::string type_string; |
| 696 CHECK(args->GetString(arg_i++, &type_string)); | 733 CHECK(args->GetString(arg_i++, &type_string)); |
| 697 | 734 |
| 698 Profile* profile = Profile::FromWebUI(web_ui_); | 735 Profile* profile = Profile::FromWebUI(web_ui_); |
| 699 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); | 736 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); |
| 700 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { | 737 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 864 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
| 828 } | 865 } |
| 829 | 866 |
| 830 HostContentSettingsMap* | 867 HostContentSettingsMap* |
| 831 ContentSettingsHandler::GetOTRContentSettingsMap() { | 868 ContentSettingsHandler::GetOTRContentSettingsMap() { |
| 832 Profile* profile = Profile::FromWebUI(web_ui_); | 869 Profile* profile = Profile::FromWebUI(web_ui_); |
| 833 if (profile->HasOffTheRecordProfile()) | 870 if (profile->HasOffTheRecordProfile()) |
| 834 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 871 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
| 835 return NULL; | 872 return NULL; |
| 836 } | 873 } |
| OLD | NEW |