OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/content_settings/permission_bubble_request_impl.h" | 5 #include "chrome/browser/content_settings/permission_bubble_request_impl.h" |
6 | 6 |
7 #include "chrome/browser/content_settings/permission_context_base.h" | 7 #include "chrome/browser/content_settings/permission_context_base.h" |
8 #include "chrome/browser/content_settings/permission_context_uma_util.h" | 8 #include "chrome/browser/content_settings/permission_context_uma_util.h" |
9 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 10 #include "components/url_formatter/url_formatter.h" |
10 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
11 #include "net/base/net_util.h" | |
12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
13 | 13 |
14 PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( | 14 PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( |
15 const GURL& request_origin, | 15 const GURL& request_origin, |
16 bool user_gesture, | 16 bool user_gesture, |
17 ContentSettingsType type, | 17 ContentSettingsType type, |
18 const std::string& display_languages, | 18 const std::string& display_languages, |
19 const PermissionDecidedCallback& permission_decided_callback, | 19 const PermissionDecidedCallback& permission_decided_callback, |
20 const base::Closure delete_callback) | 20 const base::Closure delete_callback) |
21 : request_origin_(request_origin), | 21 : request_origin_(request_origin), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 84 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
85 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; | 85 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; |
86 break; | 86 break; |
87 #endif | 87 #endif |
88 default: | 88 default: |
89 NOTREACHED(); | 89 NOTREACHED(); |
90 return base::string16(); | 90 return base::string16(); |
91 } | 91 } |
92 return l10n_util::GetStringFUTF16( | 92 return l10n_util::GetStringFUTF16( |
93 message_id, | 93 message_id, |
94 net::FormatUrl(request_origin_, display_languages_, | 94 url_formatter::FormatUrl( |
95 net::kFormatUrlOmitUsernamePassword | | 95 request_origin_, display_languages_, |
96 net::kFormatUrlOmitTrailingSlashOnBareHostname, | 96 url_formatter::kFormatUrlOmitUsernamePassword | |
97 net::UnescapeRule::SPACES, NULL, NULL, NULL)); | 97 url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, |
| 98 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); |
98 } | 99 } |
99 | 100 |
100 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { | 101 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { |
101 int message_id; | 102 int message_id; |
102 switch (type_) { | 103 switch (type_) { |
103 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 104 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
104 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 105 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |
105 break; | 106 break; |
106 #if defined(ENABLE_NOTIFICATIONS) | 107 #if defined(ENABLE_NOTIFICATIONS) |
107 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 108 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 void PermissionBubbleRequestImpl::Cancelled() { | 148 void PermissionBubbleRequestImpl::Cancelled() { |
148 RegisterActionTaken(); | 149 RegisterActionTaken(); |
149 permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); | 150 permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); |
150 } | 151 } |
151 | 152 |
152 void PermissionBubbleRequestImpl::RequestFinished() { | 153 void PermissionBubbleRequestImpl::RequestFinished() { |
153 is_finished_ = true; | 154 is_finished_ = true; |
154 delete_callback_.Run(); | 155 delete_callback_.Run(); |
155 } | 156 } |
OLD | NEW |