| 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/permissions/permission_bubble_request_impl.h" |    5 #include "chrome/browser/permissions/permission_bubble_request_impl.h" | 
|    6  |    6  | 
|    7 #include "chrome/browser/permissions/permission_context_base.h" |    7 #include "chrome/browser/permissions/permission_context_base.h" | 
|    8 #include "chrome/browser/permissions/permission_context_uma_util.h" |    8 #include "chrome/browser/permissions/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 "net/base/escape.h" | 
|   12 #include "ui/base/l10n/l10n_util.h" |   13 #include "ui/base/l10n/l10n_util.h" | 
|   13 #include "ui/gfx/vector_icons_public2.h" |   14 #include "ui/gfx/vector_icons_public2.h" | 
|   14  |   15  | 
|   15 PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( |   16 PermissionBubbleRequestImpl::PermissionBubbleRequestImpl( | 
|   16     const GURL& request_origin, |   17     const GURL& request_origin, | 
|   17     bool user_gesture, |   18     bool user_gesture, | 
|   18     ContentSettingsType type, |   19     ContentSettingsType type, | 
|   19     const std::string& display_languages, |   20     const std::string& display_languages, | 
|   20     const PermissionDecidedCallback& permission_decided_callback, |   21     const PermissionDecidedCallback& permission_decided_callback, | 
|   21     const base::Closure delete_callback) |   22     const base::Closure delete_callback) | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  102     case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |  103     case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 
|  103       message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; |  104       message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION; | 
|  104       break; |  105       break; | 
|  105 #endif |  106 #endif | 
|  106     default: |  107     default: | 
|  107       NOTREACHED(); |  108       NOTREACHED(); | 
|  108       return base::string16(); |  109       return base::string16(); | 
|  109   } |  110   } | 
|  110   return l10n_util::GetStringFUTF16( |  111   return l10n_util::GetStringFUTF16( | 
|  111       message_id, |  112       message_id, | 
|  112       net::FormatUrl(request_origin_, display_languages_, |  113       url_formatter::FormatUrl( | 
|  113                      net::kFormatUrlOmitUsernamePassword | |  114           request_origin_, display_languages_, | 
|  114                      net::kFormatUrlOmitTrailingSlashOnBareHostname, |  115           url_formatter::kFormatUrlOmitUsernamePassword | | 
|  115                      net::UnescapeRule::SPACES, NULL, NULL, NULL)); |  116               url_formatter::kFormatUrlOmitTrailingSlashOnBareHostname, | 
 |  117           net::UnescapeRule::SPACES, nullptr, nullptr, nullptr)); | 
|  116 } |  118 } | 
|  117  |  119  | 
|  118 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { |  120 base::string16 PermissionBubbleRequestImpl::GetMessageTextFragment() const { | 
|  119   int message_id; |  121   int message_id; | 
|  120   switch (type_) { |  122   switch (type_) { | 
|  121     case CONTENT_SETTINGS_TYPE_GEOLOCATION: |  123     case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 
|  122       message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |  124       message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 
|  123       break; |  125       break; | 
|  124 #if defined(ENABLE_NOTIFICATIONS) |  126 #if defined(ENABLE_NOTIFICATIONS) | 
|  125     case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |  127     case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  164  |  166  | 
|  165 void PermissionBubbleRequestImpl::Cancelled() { |  167 void PermissionBubbleRequestImpl::Cancelled() { | 
|  166   RegisterActionTaken(); |  168   RegisterActionTaken(); | 
|  167   permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); |  169   permission_decided_callback_.Run(false, CONTENT_SETTING_DEFAULT); | 
|  168 } |  170 } | 
|  169  |  171  | 
|  170 void PermissionBubbleRequestImpl::RequestFinished() { |  172 void PermissionBubbleRequestImpl::RequestFinished() { | 
|  171   is_finished_ = true; |  173   is_finished_ = true; | 
|  172   delete_callback_.Run(); |  174   delete_callback_.Run(); | 
|  173 } |  175 } | 
| OLD | NEW |