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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "components/content_settings/content/common/content_settings_messages.h
" | 28 #include "components/content_settings/content/common/content_settings_messages.h
" |
29 #include "components/content_settings/core/browser/content_settings_utils.h" | 29 #include "components/content_settings/core/browser/content_settings_utils.h" |
30 #include "components/content_settings/core/common/content_settings.h" | 30 #include "components/content_settings/core/common/content_settings.h" |
31 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
32 #include "content/public/browser/render_frame_host.h" | 32 #include "content/public/browser/render_frame_host.h" |
33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/browser/render_view_host.h" | 34 #include "content/public/browser/render_view_host.h" |
35 #include "content/public/browser/user_metrics.h" | 35 #include "content/public/browser/user_metrics.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "content/public/browser/web_contents_delegate.h" | 37 #include "content/public/browser/web_contents_delegate.h" |
| 38 #include "content/public/common/origin_util.h" |
38 #include "grit/components_strings.h" | 39 #include "grit/components_strings.h" |
39 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
40 #include "net/base/net_util.h" | 41 #include "net/base/net_util.h" |
41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/base/resource/resource_bundle.h" | 43 #include "ui/base/resource/resource_bundle.h" |
43 #include "ui/resources/grit/ui_resources.h" | 44 #include "ui/resources/grit/ui_resources.h" |
44 | 45 |
45 using base::UserMetricsAction; | 46 using base::UserMetricsAction; |
46 using content::WebContents; | 47 using content::WebContents; |
47 using content_settings::SettingInfo; | 48 using content_settings::SettingInfo; |
(...skipping 645 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 (content::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 |