| 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" |
| 11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
| 12 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 12 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 13 #include "grit/chromium_strings.h" | 13 #include "grit/chromium_strings.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/gfx/text_elider.h" | 16 #include "ui/gfx/text_elider.h" |
| 17 | 17 |
| 18 ExternalProtocolDialogDelegate::ExternalProtocolDialogDelegate(const GURL& url) | 18 ExternalProtocolDialogDelegate::ExternalProtocolDialogDelegate( |
| 19 : ProtocolDialogDelegate(url) { | 19 const GURL& url, |
| 20 int render_process_host_id, |
| 21 int tab_contents_id) |
| 22 : ProtocolDialogDelegate(url), |
| 23 render_process_host_id_(render_process_host_id), |
| 24 tab_contents_id_(tab_contents_id) { |
| 20 } | 25 } |
| 21 | 26 |
| 22 ExternalProtocolDialogDelegate::~ExternalProtocolDialogDelegate() { | 27 ExternalProtocolDialogDelegate::~ExternalProtocolDialogDelegate() { |
| 23 } | 28 } |
| 24 | 29 |
| 25 string16 ExternalProtocolDialogDelegate::GetMessageText() const { | 30 string16 ExternalProtocolDialogDelegate::GetMessageText() const { |
| 26 const int kMaxUrlWithoutSchemeSize = 256; | 31 const int kMaxUrlWithoutSchemeSize = 256; |
| 27 const int kMaxCommandSize = 256; | 32 const int kMaxCommandSize = 256; |
| 28 // TODO(calamity): Look up the command in ExternalProtocolHandler and pass it | 33 // TODO(calamity): Look up the command in ExternalProtocolHandler and pass it |
| 29 // into the constructor. Will require simultaneous change of | 34 // into the constructor. Will require simultaneous change of |
| (...skipping 28 matching lines...) Expand all Loading... |
| 58 } | 63 } |
| 59 | 64 |
| 60 void ExternalProtocolDialogDelegate::DoAccept( | 65 void ExternalProtocolDialogDelegate::DoAccept( |
| 61 const GURL& url, | 66 const GURL& url, |
| 62 bool dont_block) const { | 67 bool dont_block) const { |
| 63 if (dont_block) { | 68 if (dont_block) { |
| 64 ExternalProtocolHandler::SetBlockState( | 69 ExternalProtocolHandler::SetBlockState( |
| 65 url.scheme(), ExternalProtocolHandler::DONT_BLOCK); | 70 url.scheme(), ExternalProtocolHandler::DONT_BLOCK); |
| 66 } | 71 } |
| 67 | 72 |
| 68 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url); | 73 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck( |
| 74 url, render_process_host_id_, tab_contents_id_); |
| 69 } | 75 } |
| 70 | 76 |
| 71 void ExternalProtocolDialogDelegate::DoCancel( | 77 void ExternalProtocolDialogDelegate::DoCancel( |
| 72 const GURL& url, | 78 const GURL& url, |
| 73 bool dont_block) const { | 79 bool dont_block) const { |
| 74 if (dont_block) { | 80 if (dont_block) { |
| 75 ExternalProtocolHandler::SetBlockState( | 81 ExternalProtocolHandler::SetBlockState( |
| 76 url.scheme(), ExternalProtocolHandler::BLOCK); | 82 url.scheme(), ExternalProtocolHandler::BLOCK); |
| 77 } | 83 } |
| 78 } | 84 } |
| OLD | NEW |