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 11 matching lines...) Expand all Loading... |
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/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
27 #include "chrome/grit/generated_resources.h" | 27 #include "chrome/grit/generated_resources.h" |
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/browser/cookie_settings.h" | 30 #include "components/content_settings/core/browser/cookie_settings.h" |
31 #include "components/content_settings/core/common/content_settings.h" | 31 #include "components/content_settings/core/common/content_settings.h" |
32 #include "components/secure_display/elide_url.h" | 32 #include "components/url_formatter/elide_url.h" |
33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/render_frame_host.h" | 34 #include "content/public/browser/render_frame_host.h" |
35 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
36 #include "content/public/browser/render_view_host.h" | 36 #include "content/public/browser/render_view_host.h" |
37 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
40 #include "content/public/common/origin_util.h" | 40 #include "content/public/common/origin_util.h" |
41 #include "grit/components_strings.h" | 41 #include "grit/components_strings.h" |
42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 bool ContentSettingSingleRadioGroup::settings_changed() const { | 270 bool ContentSettingSingleRadioGroup::settings_changed() const { |
271 return selected_item_ != bubble_content().radio_group.default_item; | 271 return selected_item_ != bubble_content().radio_group.default_item; |
272 } | 272 } |
273 | 273 |
274 // Initialize the radio group by setting the appropriate labels for the | 274 // Initialize the radio group by setting the appropriate labels for the |
275 // content type and setting the default value based on the content setting. | 275 // content type and setting the default value based on the content setting. |
276 void ContentSettingSingleRadioGroup::SetRadioGroup() { | 276 void ContentSettingSingleRadioGroup::SetRadioGroup() { |
277 GURL url = web_contents()->GetURL(); | 277 GURL url = web_contents()->GetURL(); |
278 base::string16 display_host = secure_display::FormatUrlForSecurityDisplay( | 278 base::string16 display_host = url_formatter::FormatUrlForSecurityDisplay( |
279 url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 279 url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
280 if (display_host.empty()) | 280 if (display_host.empty()) |
281 display_host = base::ASCIIToUTF16(url.spec()); | 281 display_host = base::ASCIIToUTF16(url.spec()); |
282 | 282 |
283 TabSpecificContentSettings* content_settings = | 283 TabSpecificContentSettings* content_settings = |
284 TabSpecificContentSettings::FromWebContents(web_contents()); | 284 TabSpecificContentSettings::FromWebContents(web_contents()); |
285 bool allowed = | 285 bool allowed = |
286 !content_settings->IsContentBlocked(content_type()); | 286 !content_settings->IsContentBlocked(content_type()); |
287 DCHECK(!allowed || | 287 DCHECK(!allowed || |
288 content_settings->IsContentAllowed(content_type())); | 288 content_settings->IsContentAllowed(content_type())); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 } | 712 } |
713 | 713 |
714 void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { | 714 void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { |
715 TabSpecificContentSettings* content_settings = | 715 TabSpecificContentSettings* content_settings = |
716 TabSpecificContentSettings::FromWebContents(web_contents()); | 716 TabSpecificContentSettings::FromWebContents(web_contents()); |
717 GURL url = content_settings->media_stream_access_origin(); | 717 GURL url = content_settings->media_stream_access_origin(); |
718 RadioGroup radio_group; | 718 RadioGroup radio_group; |
719 radio_group.url = url; | 719 radio_group.url = url; |
720 | 720 |
721 base::string16 display_host_utf16 = | 721 base::string16 display_host_utf16 = |
722 secure_display::FormatUrlForSecurityDisplay( | 722 url_formatter::FormatUrlForSecurityDisplay( |
723 url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 723 url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
724 std::string display_host(base::UTF16ToUTF8(display_host_utf16)); | 724 std::string display_host(base::UTF16ToUTF8(display_host_utf16)); |
725 if (display_host.empty()) | 725 if (display_host.empty()) |
726 display_host = url.spec(); | 726 display_host = url.spec(); |
727 | 727 |
728 DCHECK(CameraAccessed() || MicrophoneAccessed()); | 728 DCHECK(CameraAccessed() || MicrophoneAccessed()); |
729 int radio_allow_label_id = 0; | 729 int radio_allow_label_id = 0; |
730 int radio_block_label_id = 0; | 730 int radio_block_label_id = 0; |
731 if (state_ & (TabSpecificContentSettings::MICROPHONE_BLOCKED | | 731 if (state_ & (TabSpecificContentSettings::MICROPHONE_BLOCKED | |
732 TabSpecificContentSettings::CAMERA_BLOCKED)) { | 732 TabSpecificContentSettings::CAMERA_BLOCKED)) { |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1349 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
1350 DCHECK_EQ(web_contents_, | 1350 DCHECK_EQ(web_contents_, |
1351 content::Source<WebContents>(source).ptr()); | 1351 content::Source<WebContents>(source).ptr()); |
1352 web_contents_ = NULL; | 1352 web_contents_ = NULL; |
1353 } else { | 1353 } else { |
1354 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1354 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
1355 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1355 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
1356 profile_ = NULL; | 1356 profile_ = NULL; |
1357 } | 1357 } |
1358 } | 1358 } |
OLD | NEW |