| 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/custom_handlers/register_protocol_handler_permission_re
quest.h" | 5 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_re
quest.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 RegisterProtocolHandlerPermissionRequest | 32 RegisterProtocolHandlerPermissionRequest |
| 33 ::RegisterProtocolHandlerPermissionRequest( | 33 ::RegisterProtocolHandlerPermissionRequest( |
| 34 ProtocolHandlerRegistry* registry, | 34 ProtocolHandlerRegistry* registry, |
| 35 const ProtocolHandler& handler, | 35 const ProtocolHandler& handler, |
| 36 GURL url, | 36 GURL url, |
| 37 bool user_gesture) | 37 bool user_gesture) |
| 38 : registry_(registry), | 38 : registry_(registry), |
| 39 handler_(handler), | 39 handler_(handler), |
| 40 url_(url), | 40 origin_(url.GetOrigin()), |
| 41 user_gesture_(user_gesture) {} | 41 user_gesture_(user_gesture) {} |
| 42 | 42 |
| 43 RegisterProtocolHandlerPermissionRequest:: | 43 RegisterProtocolHandlerPermissionRequest:: |
| 44 ~RegisterProtocolHandlerPermissionRequest() {} | 44 ~RegisterProtocolHandlerPermissionRequest() {} |
| 45 | 45 |
| 46 gfx::VectorIconId RegisterProtocolHandlerPermissionRequest::GetVectorIconId() | 46 gfx::VectorIconId RegisterProtocolHandlerPermissionRequest::GetVectorIconId() |
| 47 const { | 47 const { |
| 48 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 49 return gfx::VectorIconId::VECTOR_ICON_NONE; | 49 return gfx::VectorIconId::VECTOR_ICON_NONE; |
| 50 #else | 50 #else |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 l10n_util::GetStringFUTF16( | 85 l10n_util::GetStringFUTF16( |
| 86 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT, | 86 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT, |
| 87 GetProtocolName(handler_), | 87 GetProtocolName(handler_), |
| 88 base::UTF8ToUTF16(old_handler.url().host_piece())); | 88 base::UTF8ToUTF16(old_handler.url().host_piece())); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool RegisterProtocolHandlerPermissionRequest::HasUserGesture() const { | 91 bool RegisterProtocolHandlerPermissionRequest::HasUserGesture() const { |
| 92 return user_gesture_; | 92 return user_gesture_; |
| 93 } | 93 } |
| 94 | 94 |
| 95 GURL RegisterProtocolHandlerPermissionRequest::GetRequestingHostname() const { | 95 GURL RegisterProtocolHandlerPermissionRequest::GetOrigin() const { |
| 96 return url_; | 96 return origin_; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void RegisterProtocolHandlerPermissionRequest::PermissionGranted() { | 99 void RegisterProtocolHandlerPermissionRequest::PermissionGranted() { |
| 100 content::RecordAction( | 100 content::RecordAction( |
| 101 base::UserMetricsAction("RegisterProtocolHandler.Infobar_Accept")); | 101 base::UserMetricsAction("RegisterProtocolHandler.Infobar_Accept")); |
| 102 registry_->OnAcceptRegisterProtocolHandler(handler_); | 102 registry_->OnAcceptRegisterProtocolHandler(handler_); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void RegisterProtocolHandlerPermissionRequest::PermissionDenied() { | 105 void RegisterProtocolHandlerPermissionRequest::PermissionDenied() { |
| 106 content::RecordAction( | 106 content::RecordAction( |
| 107 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny")); | 107 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny")); |
| 108 registry_->OnIgnoreRegisterProtocolHandler(handler_); | 108 registry_->OnIgnoreRegisterProtocolHandler(handler_); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void RegisterProtocolHandlerPermissionRequest::Cancelled() { | 111 void RegisterProtocolHandlerPermissionRequest::Cancelled() { |
| 112 content::RecordAction( | 112 content::RecordAction( |
| 113 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny")); | 113 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny")); |
| 114 registry_->OnIgnoreRegisterProtocolHandler(handler_); | 114 registry_->OnIgnoreRegisterProtocolHandler(handler_); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void RegisterProtocolHandlerPermissionRequest::RequestFinished() { | 117 void RegisterProtocolHandlerPermissionRequest::RequestFinished() { |
| 118 delete this; | 118 delete this; |
| 119 } | 119 } |
| OLD | NEW |