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/chrome_content_settings_utils.h" | 11 #include "chrome/browser/content_settings/chrome_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/content_settings/tab_specific_content_settings.h" | 13 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 14 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 15 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.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/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/origin_util.h" |
25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
27 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
28 #include "components/content_settings/content/common/content_settings_messages.h
" | 29 #include "components/content_settings/content/common/content_settings_messages.h
" |
29 #include "components/content_settings/core/browser/content_settings_utils.h" | 30 #include "components/content_settings/core/browser/content_settings_utils.h" |
30 #include "components/content_settings/core/common/content_settings.h" | 31 #include "components/content_settings/core/common/content_settings.h" |
31 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
32 #include "content/public/browser/render_frame_host.h" | 33 #include "content/public/browser/render_frame_host.h" |
33 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/browser/render_view_host.h" | 35 #include "content/public/browser/render_view_host.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 if (display_host.empty()) | 694 if (display_host.empty()) |
694 display_host = url.spec(); | 695 display_host = url.spec(); |
695 | 696 |
696 bool is_mic = (state_ & TabSpecificContentSettings::MICROPHONE_ACCESSED) != 0; | 697 bool is_mic = (state_ & TabSpecificContentSettings::MICROPHONE_ACCESSED) != 0; |
697 bool is_cam = (state_ & TabSpecificContentSettings::CAMERA_ACCESSED) != 0; | 698 bool is_cam = (state_ & TabSpecificContentSettings::CAMERA_ACCESSED) != 0; |
698 DCHECK(is_mic || is_cam); | 699 DCHECK(is_mic || is_cam); |
699 int radio_allow_label_id = 0; | 700 int radio_allow_label_id = 0; |
700 int radio_block_label_id = 0; | 701 int radio_block_label_id = 0; |
701 if (state_ & (TabSpecificContentSettings::MICROPHONE_BLOCKED | | 702 if (state_ & (TabSpecificContentSettings::MICROPHONE_BLOCKED | |
702 TabSpecificContentSettings::CAMERA_BLOCKED)) { | 703 TabSpecificContentSettings::CAMERA_BLOCKED)) { |
703 if (url.SchemeIsSecure()) { | 704 if (IsOriginSecure(url)) { |
704 radio_item_setting_[0] = CONTENT_SETTING_ALLOW; | 705 radio_item_setting_[0] = CONTENT_SETTING_ALLOW; |
705 radio_allow_label_id = IDS_BLOCKED_MEDIASTREAM_CAMERA_ALLOW; | 706 radio_allow_label_id = IDS_BLOCKED_MEDIASTREAM_CAMERA_ALLOW; |
706 if (is_mic) | 707 if (is_mic) |
707 radio_allow_label_id = is_cam ? | 708 radio_allow_label_id = is_cam ? |
708 IDS_BLOCKED_MEDIASTREAM_MIC_AND_CAMERA_ALLOW : | 709 IDS_BLOCKED_MEDIASTREAM_MIC_AND_CAMERA_ALLOW : |
709 IDS_BLOCKED_MEDIASTREAM_MIC_ALLOW; | 710 IDS_BLOCKED_MEDIASTREAM_MIC_ALLOW; |
710 } else { | 711 } else { |
711 radio_allow_label_id = IDS_BLOCKED_MEDIASTREAM_CAMERA_ASK; | 712 radio_allow_label_id = IDS_BLOCKED_MEDIASTREAM_CAMERA_ASK; |
712 if (is_mic) | 713 if (is_mic) |
713 radio_allow_label_id = is_cam ? | 714 radio_allow_label_id = is_cam ? |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1305 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
1305 DCHECK_EQ(web_contents_, | 1306 DCHECK_EQ(web_contents_, |
1306 content::Source<WebContents>(source).ptr()); | 1307 content::Source<WebContents>(source).ptr()); |
1307 web_contents_ = NULL; | 1308 web_contents_ = NULL; |
1308 } else { | 1309 } else { |
1309 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1310 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
1310 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1311 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
1311 profile_ = NULL; | 1312 profile_ = NULL; |
1312 } | 1313 } |
1313 } | 1314 } |
OLD | NEW |