| 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 "chrome/browser/custom_handlers/protocol_handler_registry.h" | 8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 9 #include "content/public/browser/user_metrics.h" | 9 #include "content/public/browser/user_metrics.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ~RegisterProtocolHandlerPermissionRequest() {} | 39 ~RegisterProtocolHandlerPermissionRequest() {} |
| 40 | 40 |
| 41 int RegisterProtocolHandlerPermissionRequest::GetIconID() const { | 41 int RegisterProtocolHandlerPermissionRequest::GetIconID() const { |
| 42 return IDR_REGISTER_PROTOCOL_HANDLER; | 42 return IDR_REGISTER_PROTOCOL_HANDLER; |
| 43 } | 43 } |
| 44 | 44 |
| 45 base::string16 | 45 base::string16 |
| 46 RegisterProtocolHandlerPermissionRequest::GetMessageText() const { | 46 RegisterProtocolHandlerPermissionRequest::GetMessageText() const { |
| 47 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); | 47 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); |
| 48 return old_handler.IsEmpty() ? | 48 return old_handler.IsEmpty() ? |
| 49 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, | 49 l10n_util::GetStringFUTF16( |
| 50 handler_.title(), base::UTF8ToUTF16(handler_.url().host()), | 50 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, |
| 51 base::UTF8ToUTF16(handler_.url().host()), |
| 51 GetProtocolName(handler_)) : | 52 GetProtocolName(handler_)) : |
| 52 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, | 53 l10n_util::GetStringFUTF16( |
| 53 handler_.title(), base::UTF8ToUTF16(handler_.url().host()), | 54 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, |
| 54 GetProtocolName(handler_), old_handler.title()); | 55 base::UTF8ToUTF16(handler_.url().host()), |
| 56 GetProtocolName(handler_), |
| 57 base::UTF8ToUTF16(old_handler.url().host())); |
| 55 } | 58 } |
| 56 | 59 |
| 57 base::string16 | 60 base::string16 |
| 58 RegisterProtocolHandlerPermissionRequest::GetMessageTextFragment() const { | 61 RegisterProtocolHandlerPermissionRequest::GetMessageTextFragment() const { |
| 59 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); | 62 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); |
| 60 return old_handler.IsEmpty() ? | 63 return old_handler.IsEmpty() ? |
| 61 l10n_util::GetStringFUTF16(IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT, | 64 l10n_util::GetStringFUTF16( |
| 65 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT, |
| 62 GetProtocolName(handler_)) : | 66 GetProtocolName(handler_)) : |
| 63 l10n_util::GetStringFUTF16( | 67 l10n_util::GetStringFUTF16( |
| 64 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT, | 68 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT, |
| 65 GetProtocolName(handler_), old_handler.title()); | 69 GetProtocolName(handler_), |
| 70 base::UTF8ToUTF16(old_handler.url().host())); |
| 66 } | 71 } |
| 67 | 72 |
| 68 bool RegisterProtocolHandlerPermissionRequest::HasUserGesture() const { | 73 bool RegisterProtocolHandlerPermissionRequest::HasUserGesture() const { |
| 69 return user_gesture_; | 74 return user_gesture_; |
| 70 } | 75 } |
| 71 | 76 |
| 72 GURL RegisterProtocolHandlerPermissionRequest::GetRequestingHostname() const { | 77 GURL RegisterProtocolHandlerPermissionRequest::GetRequestingHostname() const { |
| 73 return url_; | 78 return url_; |
| 74 } | 79 } |
| 75 | 80 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 87 | 92 |
| 88 void RegisterProtocolHandlerPermissionRequest::Cancelled() { | 93 void RegisterProtocolHandlerPermissionRequest::Cancelled() { |
| 89 content::RecordAction( | 94 content::RecordAction( |
| 90 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny")); | 95 base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny")); |
| 91 registry_->OnIgnoreRegisterProtocolHandler(handler_); | 96 registry_->OnIgnoreRegisterProtocolHandler(handler_); |
| 92 } | 97 } |
| 93 | 98 |
| 94 void RegisterProtocolHandlerPermissionRequest::RequestFinished() { | 99 void RegisterProtocolHandlerPermissionRequest::RequestFinished() { |
| 95 delete this; | 100 delete this; |
| 96 } | 101 } |
| OLD | NEW |