OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" | 5 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
10 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
11 #include "chrome/browser/tab_contents/tab_util.h" | |
11 #include "chrome/grit/chromium_strings.h" | 12 #include "chrome/grit/chromium_strings.h" |
12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
13 #include "components/strings/grit/components_strings.h" | 14 #include "components/strings/grit/components_strings.h" |
15 #include "content/public/browser/web_contents.h" | |
msw
2016/12/19 20:26:55
optional nit: remove this include, it's not explic
davidsac (gone - try alexmos)
2016/12/19 22:23:45
Done.
| |
14 #include "ui/base/l10n/l10n_util_mac.h" | 16 #include "ui/base/l10n/l10n_util_mac.h" |
15 #include "ui/gfx/text_elider.h" | 17 #include "ui/gfx/text_elider.h" |
16 | 18 |
17 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
18 // ExternalProtocolHandler | 20 // ExternalProtocolHandler |
19 | 21 |
20 // static | 22 // static |
21 void ExternalProtocolHandler::RunExternalProtocolDialog( | 23 void ExternalProtocolHandler::RunExternalProtocolDialog( |
22 const GURL& url, int render_process_host_id, int routing_id, | 24 const GURL& url, int render_process_host_id, int routing_id, |
23 ui::PageTransition page_transition, bool has_user_gesture) { | 25 ui::PageTransition page_transition, bool has_user_gesture) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState); | 110 ExternalProtocolHandler::SetBlockState(url_.scheme(), blockState); |
109 ExternalProtocolHandler::RecordMetrics(true); | 111 ExternalProtocolHandler::RecordMetrics(true); |
110 } else { | 112 } else { |
111 ExternalProtocolHandler::RecordMetrics(false); | 113 ExternalProtocolHandler::RecordMetrics(false); |
112 } | 114 } |
113 | 115 |
114 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { | 116 if (blockState == ExternalProtocolHandler::DONT_BLOCK) { |
115 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", | 117 UMA_HISTOGRAM_LONG_TIMES("clickjacking.launch_url", |
116 base::Time::Now() - creation_time_); | 118 base::Time::Now() - creation_time_); |
117 | 119 |
118 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck( | 120 content::WebContents* web_contents = |
119 url_, render_process_host_id_, routing_id_); | 121 tab_util::GetWebContentsByID(render_process_host_id_, routing_id_); |
sky
2016/12/15 20:44:28
How do you know this returns non-null by the time
davidsac (gone - try alexmos)
2016/12/15 22:40:23
We don't. The first action in ExternalProtocolHan
msw
2016/12/19 20:26:55
I can't claim to speak for Scott, but that seems o
davidsac (gone - try alexmos)
2016/12/19 22:23:45
Acknowledged.
| |
122 | |
123 ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck(url_, web_contents); | |
120 } | 124 } |
121 | 125 |
122 [self autorelease]; | 126 [self autorelease]; |
123 } | 127 } |
124 | 128 |
125 @end | 129 @end |
OLD | NEW |