Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: chrome/browser/ui/external_protocol_dialog_delegate.cc

Issue 2591143002: Rename |tab_contents_id| to |render_view_routing_id|. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/external_protocol_dialog_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/external_protocol/external_protocol_handler.h" 7 #include "chrome/browser/external_protocol/external_protocol_handler.h"
8 #include "chrome/browser/tab_contents/tab_util.h" 8 #include "chrome/browser/tab_contents/tab_util.h"
9 #include "chrome/grit/chromium_strings.h" 9 #include "chrome/grit/chromium_strings.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "components/strings/grit/components_strings.h" 11 #include "components/strings/grit/components_strings.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/gfx/text_elider.h" 13 #include "ui/gfx/text_elider.h"
14 14
15 namespace { 15 namespace {
16 16
17 const size_t kMaxCommandSize = 32; 17 const size_t kMaxCommandSize = 32;
18 18
19 base::string16 ElideCommandName(const base::string16& command_name) { 19 base::string16 ElideCommandName(const base::string16& command_name) {
20 base::string16 elided_command; 20 base::string16 elided_command;
21 gfx::ElideString(command_name, kMaxCommandSize, &elided_command); 21 gfx::ElideString(command_name, kMaxCommandSize, &elided_command);
22 return elided_command; 22 return elided_command;
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 ExternalProtocolDialogDelegate::ExternalProtocolDialogDelegate( 27 ExternalProtocolDialogDelegate::ExternalProtocolDialogDelegate(
28 const GURL& url, 28 const GURL& url,
29 int render_process_host_id, 29 int render_process_host_id,
30 int tab_contents_id) 30 int render_view_routing_id)
31 : ProtocolDialogDelegate(url), 31 : ProtocolDialogDelegate(url),
32 render_process_host_id_(render_process_host_id), 32 render_process_host_id_(render_process_host_id),
33 tab_contents_id_(tab_contents_id), 33 render_view_routing_id_(render_view_routing_id),
34 program_name_(shell_integration::GetApplicationNameForProtocol(url)) {} 34 program_name_(shell_integration::GetApplicationNameForProtocol(url)) {}
35 35
36 ExternalProtocolDialogDelegate::~ExternalProtocolDialogDelegate() { 36 ExternalProtocolDialogDelegate::~ExternalProtocolDialogDelegate() {
37 } 37 }
38 38
39 base::string16 ExternalProtocolDialogDelegate::GetDialogButtonLabel( 39 base::string16 ExternalProtocolDialogDelegate::GetDialogButtonLabel(
40 ui::DialogButton button) const { 40 ui::DialogButton button) const {
41 if (button == ui::DIALOG_BUTTON_OK) { 41 if (button == ui::DIALOG_BUTTON_OK) {
42 return l10n_util::GetStringFUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT, 42 return l10n_util::GetStringFUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT,
43 ElideCommandName(program_name_)); 43 ElideCommandName(program_name_));
(...skipping 15 matching lines...) Expand all
59 ElideCommandName(program_name_)); 59 ElideCommandName(program_name_));
60 } 60 }
61 61
62 void ExternalProtocolDialogDelegate::DoAccept(const GURL& url, 62 void ExternalProtocolDialogDelegate::DoAccept(const GURL& url,
63 bool dont_block) const { 63 bool dont_block) const {
64 if (dont_block) { 64 if (dont_block) {
65 ExternalProtocolHandler::SetBlockState(url.scheme(), 65 ExternalProtocolHandler::SetBlockState(url.scheme(),
66 ExternalProtocolHandler::DONT_BLOCK); 66 ExternalProtocolHandler::DONT_BLOCK);
67 } 67 }
68 68
69 content::WebContents* web_contents = 69 content::WebContents* web_contents = tab_util::GetWebContentsByID(
70 tab_util::GetWebContentsByID(render_process_host_id_, tab_contents_id_); 70 render_process_host_id_, render_view_routing_id_);
71 71
72 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url, web_contents); 72 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url, web_contents);
73 } 73 }
74 74
75 void ExternalProtocolDialogDelegate::DoCancel(const GURL& url, 75 void ExternalProtocolDialogDelegate::DoCancel(const GURL& url,
76 bool dont_block) const { 76 bool dont_block) const {
77 if (dont_block) { 77 if (dont_block) {
78 ExternalProtocolHandler::SetBlockState(url.scheme(), 78 ExternalProtocolHandler::SetBlockState(url.scheme(),
79 ExternalProtocolHandler::BLOCK); 79 ExternalProtocolHandler::BLOCK);
80 } 80 }
81 } 81 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/external_protocol_dialog_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698