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/content_settings/content_setting_bubble_model.h" | 5 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/content_settings/content_settings_utils.h" | 11 #include "chrome/browser/content_settings/content_settings_utils.h" |
12 #include "chrome/browser/content_settings/cookie_settings.h" | 12 #include "chrome/browser/content_settings/cookie_settings.h" |
13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
14 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 14 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
15 #include "chrome/browser/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
16 #include "chrome/browser/infobars/infobar_service.h" | 16 #include "chrome/browser/infobars/infobar_service.h" |
17 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 17 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
18 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 18 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 20 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
21 #include "chrome/browser/ui/browser_navigator.h" | 21 #include "chrome/browser/ui/browser_navigator.h" |
22 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" | 22 #include "chrome/browser/ui/collected_cookies_infobar_delegate.h" |
23 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" | 23 #include "chrome/browser/ui/content_settings/content_setting_bubble_model_delega
te.h" |
24 #include "chrome/browser/ui/content_settings/media_setting_changed_infobar_deleg
ate.h" | 24 #include "chrome/browser/ui/content_settings/media_setting_changed_infobar_deleg
ate.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/content_settings.h" | 26 #include "chrome/common/content_settings.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
| 29 #include "chrome/grit/generated_resources.h" |
29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
30 #include "content/public/browser/render_frame_host.h" | 31 #include "content/public/browser/render_frame_host.h" |
31 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
32 #include "content/public/browser/render_view_host.h" | 33 #include "content/public/browser/render_view_host.h" |
33 #include "content/public/browser/user_metrics.h" | 34 #include "content/public/browser/user_metrics.h" |
34 #include "content/public/browser/web_contents.h" | 35 #include "content/public/browser/web_contents.h" |
35 #include "content/public/browser/web_contents_delegate.h" | 36 #include "content/public/browser/web_contents_delegate.h" |
36 #include "grit/generated_resources.h" | |
37 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
38 #include "net/base/net_util.h" | 38 #include "net/base/net_util.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
41 #include "ui/resources/grit/ui_resources.h" | 41 #include "ui/resources/grit/ui_resources.h" |
42 | 42 |
43 using base::UserMetricsAction; | 43 using base::UserMetricsAction; |
44 using content::WebContents; | 44 using content::WebContents; |
45 using content_settings::SettingInfo; | 45 using content_settings::SettingInfo; |
46 using content_settings::SettingSource; | 46 using content_settings::SettingSource; |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 DCHECK_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE, type); | 799 DCHECK_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE, type); |
800 prefs->SetString(prefs::kDefaultVideoCaptureDevice, device); | 800 prefs->SetString(prefs::kDefaultVideoCaptureDevice, device); |
801 } | 801 } |
802 } | 802 } |
803 | 803 |
804 void ContentSettingMediaStreamBubbleModel::SetMediaMenus() { | 804 void ContentSettingMediaStreamBubbleModel::SetMediaMenus() { |
805 TabSpecificContentSettings* content_settings = | 805 TabSpecificContentSettings* content_settings = |
806 TabSpecificContentSettings::FromWebContents(web_contents()); | 806 TabSpecificContentSettings::FromWebContents(web_contents()); |
807 const std::string& requested_microphone = | 807 const std::string& requested_microphone = |
808 content_settings->media_stream_requested_audio_device(); | 808 content_settings->media_stream_requested_audio_device(); |
809 const std::string& requested_camera = | 809 const std::string& requested_camera = |
810 content_settings->media_stream_requested_video_device(); | 810 content_settings->media_stream_requested_video_device(); |
811 | 811 |
812 // Add microphone menu. | 812 // Add microphone menu. |
813 PrefService* prefs = profile()->GetPrefs(); | 813 PrefService* prefs = profile()->GetPrefs(); |
814 MediaCaptureDevicesDispatcher* dispatcher = | 814 MediaCaptureDevicesDispatcher* dispatcher = |
815 MediaCaptureDevicesDispatcher::GetInstance(); | 815 MediaCaptureDevicesDispatcher::GetInstance(); |
816 const content::MediaStreamDevices& microphones = | 816 const content::MediaStreamDevices& microphones = |
817 dispatcher->GetAudioCaptureDevices(); | 817 dispatcher->GetAudioCaptureDevices(); |
818 | 818 |
819 bool show_mic_menu = | 819 bool show_mic_menu = |
820 (state_ == TabSpecificContentSettings::MICROPHONE_ACCESSED || | 820 (state_ == TabSpecificContentSettings::MICROPHONE_ACCESSED || |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 WebContents* web_contents, | 1022 WebContents* web_contents, |
1023 Profile* profile, | 1023 Profile* profile, |
1024 ProtocolHandlerRegistry* registry, | 1024 ProtocolHandlerRegistry* registry, |
1025 ContentSettingsType content_type) | 1025 ContentSettingsType content_type) |
1026 : ContentSettingTitleAndLinkModel( | 1026 : ContentSettingTitleAndLinkModel( |
1027 delegate, web_contents, profile, content_type), | 1027 delegate, web_contents, profile, content_type), |
1028 selected_item_(0), | 1028 selected_item_(0), |
1029 registry_(registry), | 1029 registry_(registry), |
1030 pending_handler_(ProtocolHandler::EmptyProtocolHandler()), | 1030 pending_handler_(ProtocolHandler::EmptyProtocolHandler()), |
1031 previous_handler_(ProtocolHandler::EmptyProtocolHandler()) { | 1031 previous_handler_(ProtocolHandler::EmptyProtocolHandler()) { |
1032 | |
1033 DCHECK_EQ(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, content_type); | 1032 DCHECK_EQ(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, content_type); |
1034 | 1033 |
1035 TabSpecificContentSettings* content_settings = | 1034 TabSpecificContentSettings* content_settings = |
1036 TabSpecificContentSettings::FromWebContents(web_contents); | 1035 TabSpecificContentSettings::FromWebContents(web_contents); |
1037 pending_handler_ = content_settings->pending_protocol_handler(); | 1036 pending_handler_ = content_settings->pending_protocol_handler(); |
1038 previous_handler_ = content_settings->previous_protocol_handler(); | 1037 previous_handler_ = content_settings->previous_protocol_handler(); |
1039 | 1038 |
1040 base::string16 protocol; | 1039 base::string16 protocol; |
1041 if (pending_handler_.protocol() == "mailto") { | 1040 if (pending_handler_.protocol() == "mailto") { |
1042 protocol = l10n_util::GetStringUTF16( | 1041 protocol = l10n_util::GetStringUTF16( |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1322 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
1324 DCHECK_EQ(web_contents_, | 1323 DCHECK_EQ(web_contents_, |
1325 content::Source<WebContents>(source).ptr()); | 1324 content::Source<WebContents>(source).ptr()); |
1326 web_contents_ = NULL; | 1325 web_contents_ = NULL; |
1327 } else { | 1326 } else { |
1328 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1327 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
1329 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1328 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
1330 profile_ = NULL; | 1329 profile_ = NULL; |
1331 } | 1330 } |
1332 } | 1331 } |
OLD | NEW |