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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 int RegisterProtocolHandlerPermissionRequest::GetIconId() const { | 54 int RegisterProtocolHandlerPermissionRequest::GetIconId() const { |
55 #if defined(OS_MACOSX) | 55 #if defined(OS_MACOSX) |
56 return IDR_REGISTER_PROTOCOL_HANDLER; | 56 return IDR_REGISTER_PROTOCOL_HANDLER; |
57 #else | 57 #else |
58 return 0; | 58 return 0; |
59 #endif | 59 #endif |
60 } | 60 } |
61 | 61 |
62 base::string16 | 62 base::string16 |
63 RegisterProtocolHandlerPermissionRequest::GetMessageText() const { | |
64 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); | |
65 return old_handler.IsEmpty() ? | |
66 l10n_util::GetStringFUTF16( | |
67 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM, | |
68 base::UTF8ToUTF16(handler_.url().host_piece()), | |
69 GetProtocolName(handler_)) : | |
70 l10n_util::GetStringFUTF16( | |
71 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE, | |
72 base::UTF8ToUTF16(handler_.url().host_piece()), | |
73 GetProtocolName(handler_), | |
74 base::UTF8ToUTF16(old_handler.url().host_piece())); | |
75 } | |
76 | |
77 base::string16 | |
78 RegisterProtocolHandlerPermissionRequest::GetMessageTextFragment() const { | 63 RegisterProtocolHandlerPermissionRequest::GetMessageTextFragment() const { |
79 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); | 64 ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol()); |
80 return old_handler.IsEmpty() ? | 65 return old_handler.IsEmpty() ? |
81 l10n_util::GetStringFUTF16( | 66 l10n_util::GetStringFUTF16( |
82 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT, | 67 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_FRAGMENT, |
83 GetProtocolName(handler_)) : | 68 GetProtocolName(handler_)) : |
84 l10n_util::GetStringFUTF16( | 69 l10n_util::GetStringFUTF16( |
85 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT, | 70 IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE_FRAGMENT, |
86 GetProtocolName(handler_), | 71 GetProtocolName(handler_), |
87 base::UTF8ToUTF16(old_handler.url().host_piece())); | 72 base::UTF8ToUTF16(old_handler.url().host_piece())); |
(...skipping 22 matching lines...) Expand all Loading... |
110 } | 95 } |
111 | 96 |
112 void RegisterProtocolHandlerPermissionRequest::RequestFinished() { | 97 void RegisterProtocolHandlerPermissionRequest::RequestFinished() { |
113 delete this; | 98 delete this; |
114 } | 99 } |
115 | 100 |
116 PermissionBubbleType | 101 PermissionBubbleType |
117 RegisterProtocolHandlerPermissionRequest::GetPermissionBubbleType() const { | 102 RegisterProtocolHandlerPermissionRequest::GetPermissionBubbleType() const { |
118 return PermissionBubbleType::REGISTER_PROTOCOL_HANDLER; | 103 return PermissionBubbleType::REGISTER_PROTOCOL_HANDLER; |
119 } | 104 } |
OLD | NEW |