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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 bool ContentSettingSingleRadioGroup::settings_changed() const { | 243 bool ContentSettingSingleRadioGroup::settings_changed() const { |
244 return selected_item_ != bubble_content().radio_group.default_item; | 244 return selected_item_ != bubble_content().radio_group.default_item; |
245 } | 245 } |
246 | 246 |
247 // Initialize the radio group by setting the appropriate labels for the | 247 // Initialize the radio group by setting the appropriate labels for the |
248 // content type and setting the default value based on the content setting. | 248 // content type and setting the default value based on the content setting. |
249 void ContentSettingSingleRadioGroup::SetRadioGroup() { | 249 void ContentSettingSingleRadioGroup::SetRadioGroup() { |
250 GURL url = web_contents()->GetURL(); | 250 GURL url = web_contents()->GetURL(); |
251 base::string16 display_host = url_formatter::FormatUrlForSecurityDisplay( | 251 base::string16 display_host = |
252 url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 252 url_formatter::FormatUrlForSecurityDisplay(url); |
253 if (display_host.empty()) | 253 if (display_host.empty()) |
254 display_host = base::ASCIIToUTF16(url.spec()); | 254 display_host = base::ASCIIToUTF16(url.spec()); |
255 | 255 |
256 TabSpecificContentSettings* content_settings = | 256 TabSpecificContentSettings* content_settings = |
257 TabSpecificContentSettings::FromWebContents(web_contents()); | 257 TabSpecificContentSettings::FromWebContents(web_contents()); |
258 bool allowed = | 258 bool allowed = |
259 !content_settings->IsContentBlocked(content_type()); | 259 !content_settings->IsContentBlocked(content_type()); |
260 DCHECK(!allowed || | 260 DCHECK(!allowed || |
261 content_settings->IsContentAllowed(content_type())); | 261 content_settings->IsContentAllowed(content_type())); |
262 | 262 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 651 } |
652 | 652 |
653 void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { | 653 void ContentSettingMediaStreamBubbleModel::SetRadioGroup() { |
654 TabSpecificContentSettings* content_settings = | 654 TabSpecificContentSettings* content_settings = |
655 TabSpecificContentSettings::FromWebContents(web_contents()); | 655 TabSpecificContentSettings::FromWebContents(web_contents()); |
656 GURL url = content_settings->media_stream_access_origin(); | 656 GURL url = content_settings->media_stream_access_origin(); |
657 RadioGroup radio_group; | 657 RadioGroup radio_group; |
658 radio_group.url = url; | 658 radio_group.url = url; |
659 | 659 |
660 base::string16 display_host_utf16 = | 660 base::string16 display_host_utf16 = |
661 url_formatter::FormatUrlForSecurityDisplay( | 661 url_formatter::FormatUrlForSecurityDisplay(url); |
662 url, profile()->GetPrefs()->GetString(prefs::kAcceptLanguages)); | |
663 std::string display_host(base::UTF16ToUTF8(display_host_utf16)); | 662 std::string display_host(base::UTF16ToUTF8(display_host_utf16)); |
664 if (display_host.empty()) | 663 if (display_host.empty()) |
665 display_host = url.spec(); | 664 display_host = url.spec(); |
666 | 665 |
667 DCHECK(CameraAccessed() || MicrophoneAccessed()); | 666 DCHECK(CameraAccessed() || MicrophoneAccessed()); |
668 int radio_allow_label_id = 0; | 667 int radio_allow_label_id = 0; |
669 int radio_block_label_id = 0; | 668 int radio_block_label_id = 0; |
670 if (state_ & (TabSpecificContentSettings::MICROPHONE_BLOCKED | | 669 if (state_ & (TabSpecificContentSettings::MICROPHONE_BLOCKED | |
671 TabSpecificContentSettings::CAMERA_BLOCKED)) { | 670 TabSpecificContentSettings::CAMERA_BLOCKED)) { |
672 if (content::IsOriginSecure(url)) { | 671 if (content::IsOriginSecure(url)) { |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 ContentSettingBubbleModel::AsSimpleBubbleModel() { | 1317 ContentSettingBubbleModel::AsSimpleBubbleModel() { |
1319 // In general, bubble models might not inherit from the simple bubble model. | 1318 // In general, bubble models might not inherit from the simple bubble model. |
1320 return nullptr; | 1319 return nullptr; |
1321 } | 1320 } |
1322 | 1321 |
1323 ContentSettingMediaStreamBubbleModel* | 1322 ContentSettingMediaStreamBubbleModel* |
1324 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { | 1323 ContentSettingBubbleModel::AsMediaStreamBubbleModel() { |
1325 // In general, bubble models might not inherit from the media bubble model. | 1324 // In general, bubble models might not inherit from the media bubble model. |
1326 return nullptr; | 1325 return nullptr; |
1327 } | 1326 } |
OLD | NEW |