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

Side by Side Diff: chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc

Issue 2459803002: Handle navigations with PAGE_TRANSITION_CLIENT_REDIRECT qualifier (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/arc/arc_external_protocol_dialog.h" 5 #include "chrome/browser/chromeos/arc/arc_external_protocol_dialog.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 routing_id, url, base::Passed(&handlers))); 187 routing_id, url, base::Passed(&handlers)));
188 } 188 }
189 189
190 } // namespace 190 } // namespace
191 191
192 bool RunArcExternalProtocolDialog(const GURL& url, 192 bool RunArcExternalProtocolDialog(const GURL& url,
193 int render_process_host_id, 193 int render_process_host_id,
194 int routing_id, 194 int routing_id,
195 ui::PageTransition page_transition, 195 ui::PageTransition page_transition,
196 bool has_user_gesture) { 196 bool has_user_gesture) {
197 // Handle client-side redirections. Forwarding such navigations to ARC is
198 // better than just showing the "can't open" dialog.
199 // TODO(djacobo): Check if doing this in arc::ShouldIgnoreNavigation is safe,
200 // and move it to the function if it is. (b/32442730#comment3)
201 page_transition = ui::PageTransitionFromInt(
202 page_transition & ~ui::PAGE_TRANSITION_CLIENT_REDIRECT);
203
197 // Try to forward <form> submissions to ARC when possible. 204 // Try to forward <form> submissions to ARC when possible.
198 constexpr bool kAllowFormSubmit = true; 205 constexpr bool kAllowFormSubmit = true;
199 if (ShouldIgnoreNavigation(page_transition, kAllowFormSubmit)) 206 if (ShouldIgnoreNavigation(page_transition, kAllowFormSubmit))
200 return false; 207 return false;
201 208
202 auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance( 209 auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance(
203 "RequestUrlHandlerList", kMinVersionForRequestUrlHandlerList); 210 "RequestUrlHandlerList", kMinVersionForRequestUrlHandlerList);
204 if (!instance) 211 if (!instance)
205 return false; // ARC is either not supported or not yet ready. 212 return false; // ARC is either not supported or not yet ready.
206 213
207 WebContents* web_contents = 214 WebContents* web_contents =
208 tab_util::GetWebContentsByID(render_process_host_id, routing_id); 215 tab_util::GetWebContentsByID(render_process_host_id, routing_id);
209 if (!web_contents || !web_contents->GetBrowserContext() || 216 if (!web_contents || !web_contents->GetBrowserContext() ||
210 web_contents->GetBrowserContext()->IsOffTheRecord()) { 217 web_contents->GetBrowserContext()->IsOffTheRecord()) {
211 return false; 218 return false;
212 } 219 }
213 220
214 // Show ARC version of the dialog, which is IntentPickerBubbleView. To show 221 // Show ARC version of the dialog, which is IntentPickerBubbleView. To show
215 // the bubble view, we need to ask ARC for a handler list first. 222 // the bubble view, we need to ask ARC for a handler list first.
216 instance->RequestUrlHandlerList( 223 instance->RequestUrlHandlerList(
217 url.spec(), 224 url.spec(),
218 base::Bind(OnUrlHandlerList, render_process_host_id, routing_id, url)); 225 base::Bind(OnUrlHandlerList, render_process_host_id, routing_id, url));
219 return true; 226 return true;
220 } 227 }
221 228
222 } // namespace arc 229 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698