| OLD | NEW | 
|   1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2013 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/ui/external_protocol_dialog_delegate.h" |   5 #include "chrome/browser/ui/external_protocol_dialog_delegate.h" | 
|   6  |   6  | 
|   7 #include <string> |   7 #include <string> | 
|   8  |   8  | 
|   9 #include "base/strings/utf_string_conversions.h" |   9 #include "base/strings/utf_string_conversions.h" | 
|  10 #include "base/threading/thread.h" |  10 #include "base/threading/thread.h" | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  27 ExternalProtocolDialogDelegate::~ExternalProtocolDialogDelegate() { |  27 ExternalProtocolDialogDelegate::~ExternalProtocolDialogDelegate() { | 
|  28 } |  28 } | 
|  29  |  29  | 
|  30 base::string16 ExternalProtocolDialogDelegate::GetMessageText() const { |  30 base::string16 ExternalProtocolDialogDelegate::GetMessageText() const { | 
|  31   const int kMaxUrlWithoutSchemeSize = 256; |  31   const int kMaxUrlWithoutSchemeSize = 256; | 
|  32   const int kMaxCommandSize = 256; |  32   const int kMaxCommandSize = 256; | 
|  33   // TODO(calamity): Look up the command in ExternalProtocolHandler and pass it |  33   // TODO(calamity): Look up the command in ExternalProtocolHandler and pass it | 
|  34   // into the constructor. Will require simultaneous change of |  34   // into the constructor. Will require simultaneous change of | 
|  35   // ExternalProtocolHandler::RunExternalProtocolDialog across all platforms. |  35   // ExternalProtocolHandler::RunExternalProtocolDialog across all platforms. | 
|  36   base::string16 command = |  36   base::string16 command = | 
|  37     UTF8ToUTF16(ShellIntegration::GetApplicationForProtocol(url())); |  37     base::UTF8ToUTF16(ShellIntegration::GetApplicationForProtocol(url())); | 
|  38   base::string16 elided_url_without_scheme; |  38   base::string16 elided_url_without_scheme; | 
|  39   base::string16 elided_command; |  39   base::string16 elided_command; | 
|  40   gfx::ElideString(ASCIIToUTF16(url().possibly_invalid_spec()), |  40   gfx::ElideString(base::ASCIIToUTF16(url().possibly_invalid_spec()), | 
|  41                   kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); |  41                   kMaxUrlWithoutSchemeSize, &elided_url_without_scheme); | 
|  42   gfx::ElideString(command, kMaxCommandSize, &elided_command); |  42   gfx::ElideString(command, kMaxCommandSize, &elided_command); | 
|  43  |  43  | 
|  44   base::string16 message_text = l10n_util::GetStringFUTF16( |  44   base::string16 message_text = l10n_util::GetStringFUTF16( | 
|  45       IDS_EXTERNAL_PROTOCOL_INFORMATION, |  45       IDS_EXTERNAL_PROTOCOL_INFORMATION, | 
|  46       ASCIIToUTF16(url().scheme() + ":"), |  46       base::ASCIIToUTF16(url().scheme() + ":"), | 
|  47       elided_url_without_scheme) + ASCIIToUTF16("\n\n"); |  47       elided_url_without_scheme) + base::ASCIIToUTF16("\n\n"); | 
|  48  |  48  | 
|  49   message_text += l10n_util::GetStringFUTF16( |  49   message_text += l10n_util::GetStringFUTF16( | 
|  50       IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, |  50       IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, | 
|  51       elided_command) + ASCIIToUTF16("\n\n"); |  51       elided_command) + base::ASCIIToUTF16("\n\n"); | 
|  52  |  52  | 
|  53   message_text += l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_WARNING); |  53   message_text += l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_WARNING); | 
|  54   return message_text; |  54   return message_text; | 
|  55 } |  55 } | 
|  56  |  56  | 
|  57 base::string16 ExternalProtocolDialogDelegate::GetCheckboxText() const { |  57 base::string16 ExternalProtocolDialogDelegate::GetCheckboxText() const { | 
|  58   return l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT); |  58   return l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT); | 
|  59 } |  59 } | 
|  60  |  60  | 
|  61 base::string16 ExternalProtocolDialogDelegate::GetTitleText() const { |  61 base::string16 ExternalProtocolDialogDelegate::GetTitleText() const { | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|  75 } |  75 } | 
|  76  |  76  | 
|  77 void ExternalProtocolDialogDelegate::DoCancel( |  77 void ExternalProtocolDialogDelegate::DoCancel( | 
|  78     const GURL& url, |  78     const GURL& url, | 
|  79     bool dont_block) const { |  79     bool dont_block) const { | 
|  80   if (dont_block) { |  80   if (dont_block) { | 
|  81       ExternalProtocolHandler::SetBlockState( |  81       ExternalProtocolHandler::SetBlockState( | 
|  82           url.scheme(), ExternalProtocolHandler::BLOCK); |  82           url.scheme(), ExternalProtocolHandler::BLOCK); | 
|  83   } |  83   } | 
|  84 } |  84 } | 
| OLD | NEW |