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