| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // content type and setting the default value based on the content setting. | 243 // content type and setting the default value based on the content setting. |
| 244 void ContentSettingSingleRadioGroup::SetRadioGroup() { | 244 void ContentSettingSingleRadioGroup::SetRadioGroup() { |
| 245 GURL url = web_contents()->GetURL(); | 245 GURL url = web_contents()->GetURL(); |
| 246 base::string16 display_host; | 246 base::string16 display_host; |
| 247 net::AppendFormattedHost( | 247 net::AppendFormattedHost( |
| 248 url, | 248 url, |
| 249 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), | 249 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 250 &display_host); | 250 &display_host); |
| 251 | 251 |
| 252 if (display_host.empty()) | 252 if (display_host.empty()) |
| 253 display_host = ASCIIToUTF16(url.spec()); | 253 display_host = base::ASCIIToUTF16(url.spec()); |
| 254 | 254 |
| 255 TabSpecificContentSettings* content_settings = | 255 TabSpecificContentSettings* content_settings = |
| 256 TabSpecificContentSettings::FromWebContents(web_contents()); | 256 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 257 bool allowed = | 257 bool allowed = |
| 258 !content_settings->IsContentBlocked(content_type()); | 258 !content_settings->IsContentBlocked(content_type()); |
| 259 DCHECK(!allowed || | 259 DCHECK(!allowed || |
| 260 content_settings->IsContentAllowed(content_type())); | 260 content_settings->IsContentAllowed(content_type())); |
| 261 | 261 |
| 262 RadioGroup radio_group; | 262 RadioGroup radio_group; |
| 263 radio_group.url = url; | 263 radio_group.url = url; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 TabSpecificContentSettings::FromWebContents(web_contents()); | 650 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 651 GURL url = content_settings->media_stream_access_origin(); | 651 GURL url = content_settings->media_stream_access_origin(); |
| 652 RadioGroup radio_group; | 652 RadioGroup radio_group; |
| 653 radio_group.url = url; | 653 radio_group.url = url; |
| 654 | 654 |
| 655 base::string16 display_host_utf16; | 655 base::string16 display_host_utf16; |
| 656 net::AppendFormattedHost( | 656 net::AppendFormattedHost( |
| 657 url, | 657 url, |
| 658 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), | 658 profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 659 &display_host_utf16); | 659 &display_host_utf16); |
| 660 std::string display_host(UTF16ToUTF8(display_host_utf16)); | 660 std::string display_host(base::UTF16ToUTF8(display_host_utf16)); |
| 661 if (display_host.empty()) | 661 if (display_host.empty()) |
| 662 display_host = url.spec(); | 662 display_host = url.spec(); |
| 663 | 663 |
| 664 int radio_allow_label_id = 0; | 664 int radio_allow_label_id = 0; |
| 665 int radio_block_label_id = 0; | 665 int radio_block_label_id = 0; |
| 666 switch (state_) { | 666 switch (state_) { |
| 667 case TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED: | 667 case TabSpecificContentSettings::MICROPHONE_CAMERA_NOT_ACCESSED: |
| 668 NOTREACHED(); | 668 NOTREACHED(); |
| 669 return; | 669 return; |
| 670 case TabSpecificContentSettings::MICROPHONE_ACCESSED: | 670 case TabSpecificContentSettings::MICROPHONE_ACCESSED: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } else { | 711 } else { |
| 712 radio_allow_label_id = IDS_BLOCKED_MEDIASTREAM_MIC_AND_CAMERA_ASK; | 712 radio_allow_label_id = IDS_BLOCKED_MEDIASTREAM_MIC_AND_CAMERA_ASK; |
| 713 } | 713 } |
| 714 | 714 |
| 715 radio_block_label_id = IDS_BLOCKED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION; | 715 radio_block_label_id = IDS_BLOCKED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION; |
| 716 selected_item_ = 1; | 716 selected_item_ = 1; |
| 717 break; | 717 break; |
| 718 } | 718 } |
| 719 | 719 |
| 720 std::string radio_allow_label = l10n_util::GetStringFUTF8( | 720 std::string radio_allow_label = l10n_util::GetStringFUTF8( |
| 721 radio_allow_label_id, UTF8ToUTF16(display_host)); | 721 radio_allow_label_id, base::UTF8ToUTF16(display_host)); |
| 722 std::string radio_block_label = | 722 std::string radio_block_label = |
| 723 l10n_util::GetStringUTF8(radio_block_label_id); | 723 l10n_util::GetStringUTF8(radio_block_label_id); |
| 724 | 724 |
| 725 radio_group.default_item = selected_item_; | 725 radio_group.default_item = selected_item_; |
| 726 radio_group.radio_items.push_back(radio_allow_label); | 726 radio_group.radio_items.push_back(radio_allow_label); |
| 727 radio_group.radio_items.push_back(radio_block_label); | 727 radio_group.radio_items.push_back(radio_block_label); |
| 728 | 728 |
| 729 set_radio_group(radio_group); | 729 set_radio_group(radio_group); |
| 730 set_radio_group_enabled(true); | 730 set_radio_group_enabled(true); |
| 731 } | 731 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 previous_handler_ = content_settings->previous_protocol_handler(); | 1013 previous_handler_ = content_settings->previous_protocol_handler(); |
| 1014 | 1014 |
| 1015 base::string16 protocol; | 1015 base::string16 protocol; |
| 1016 if (pending_handler_.protocol() == "mailto") { | 1016 if (pending_handler_.protocol() == "mailto") { |
| 1017 protocol = l10n_util::GetStringUTF16( | 1017 protocol = l10n_util::GetStringUTF16( |
| 1018 IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); | 1018 IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME); |
| 1019 } else if (pending_handler_.protocol() == "webcal") { | 1019 } else if (pending_handler_.protocol() == "webcal") { |
| 1020 protocol = l10n_util::GetStringUTF16( | 1020 protocol = l10n_util::GetStringUTF16( |
| 1021 IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); | 1021 IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME); |
| 1022 } else { | 1022 } else { |
| 1023 protocol = UTF8ToUTF16(pending_handler_.protocol()); | 1023 protocol = base::UTF8ToUTF16(pending_handler_.protocol()); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 if (previous_handler_.IsEmpty()) { | 1026 if (previous_handler_.IsEmpty()) { |
| 1027 set_title(l10n_util::GetStringFUTF8( | 1027 set_title(l10n_util::GetStringFUTF8( |
| 1028 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, | 1028 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, |
| 1029 pending_handler_.title(), UTF8ToUTF16(pending_handler_.url().host()), | 1029 pending_handler_.title(), |
| 1030 base::UTF8ToUTF16(pending_handler_.url().host()), |
| 1030 protocol)); | 1031 protocol)); |
| 1031 } else { | 1032 } else { |
| 1032 set_title(l10n_util::GetStringFUTF8( | 1033 set_title(l10n_util::GetStringFUTF8( |
| 1033 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, | 1034 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, |
| 1034 pending_handler_.title(), UTF8ToUTF16(pending_handler_.url().host()), | 1035 pending_handler_.title(), |
| 1036 base::UTF8ToUTF16(pending_handler_.url().host()), |
| 1035 protocol, previous_handler_.title())); | 1037 protocol, previous_handler_.title())); |
| 1036 } | 1038 } |
| 1037 | 1039 |
| 1038 std::string radio_allow_label = | 1040 std::string radio_allow_label = |
| 1039 l10n_util::GetStringFUTF8(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT, | 1041 l10n_util::GetStringFUTF8(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT, |
| 1040 pending_handler_.title()); | 1042 pending_handler_.title()); |
| 1041 std::string radio_deny_label = | 1043 std::string radio_deny_label = |
| 1042 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_DENY); | 1044 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_DENY); |
| 1043 std::string radio_ignore_label = | 1045 std::string radio_ignore_label = |
| 1044 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_IGNORE); | 1046 l10n_util::GetStringUTF8(IDS_REGISTER_PROTOCOL_HANDLER_IGNORE); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 1299 if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
| 1298 DCHECK_EQ(web_contents_, | 1300 DCHECK_EQ(web_contents_, |
| 1299 content::Source<WebContents>(source).ptr()); | 1301 content::Source<WebContents>(source).ptr()); |
| 1300 web_contents_ = NULL; | 1302 web_contents_ = NULL; |
| 1301 } else { | 1303 } else { |
| 1302 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); | 1304 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_DESTROYED, type); |
| 1303 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); | 1305 DCHECK_EQ(profile_, content::Source<Profile>(source).ptr()); |
| 1304 profile_ = NULL; | 1306 profile_ = NULL; |
| 1305 } | 1307 } |
| 1306 } | 1308 } |
| OLD | NEW |