Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/intent_helper/arc_external_protocol_dialog .h" | 5 #include "chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog .h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 } // namespace | 342 } // namespace |
| 343 | 343 |
| 344 bool RunArcExternalProtocolDialog(const GURL& url, | 344 bool RunArcExternalProtocolDialog(const GURL& url, |
| 345 int render_process_host_id, | 345 int render_process_host_id, |
| 346 int routing_id, | 346 int routing_id, |
| 347 ui::PageTransition page_transition, | 347 ui::PageTransition page_transition, |
| 348 bool has_user_gesture) { | 348 bool has_user_gesture) { |
| 349 // This function is for external protocols that Chrome cannot handle. | 349 // This function is for external protocols that Chrome cannot handle. |
| 350 DCHECK(!url.SchemeIsHTTPOrHTTPS()) << url; | 350 DCHECK(!url.SchemeIsHTTPOrHTTPS()) << url; |
| 351 | 351 |
| 352 // Handle client-side redirections. Forwarding such navigations to ARC is | |
| 353 // better than just showing the "can't open" dialog. | |
| 354 // TODO(djacobo): Check if doing this in arc::ShouldIgnoreNavigation is safe, | |
| 355 // and move it to the function if it is. (b/32442730#comment3) | |
|
djacobo_
2016/10/26 22:41:06
I will, thanks!
| |
| 356 page_transition = ui::PageTransitionFromInt( | |
| 357 page_transition & ~ui::PAGE_TRANSITION_CLIENT_REDIRECT); | |
| 358 | |
| 352 // Try to forward <form> submissions to ARC when possible. | 359 // Try to forward <form> submissions to ARC when possible. |
| 353 constexpr bool kAllowFormSubmit = true; | 360 constexpr bool kAllowFormSubmit = true; |
| 354 if (ShouldIgnoreNavigation(page_transition, kAllowFormSubmit)) | 361 if (ShouldIgnoreNavigation(page_transition, kAllowFormSubmit)) |
| 355 return false; | 362 return false; |
| 356 | 363 |
| 357 auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance( | 364 auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance( |
| 358 "RequestUrlHandlerList", kMinVersionForRequestUrlHandlerList); | 365 "RequestUrlHandlerList", kMinVersionForRequestUrlHandlerList); |
| 359 if (!instance) | 366 if (!instance) |
| 360 return false; // ARC is either not supported or not yet ready. | 367 return false; // ARC is either not supported or not yet ready. |
| 361 | 368 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 377 GetActionResult GetActionForTesting( | 384 GetActionResult GetActionForTesting( |
| 378 const GURL& original_url, | 385 const GURL& original_url, |
| 379 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, | 386 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, |
| 380 size_t selected_app_index, | 387 size_t selected_app_index, |
| 381 std::pair<GURL, std::string>* out_url_and_package) { | 388 std::pair<GURL, std::string>* out_url_and_package) { |
| 382 return GetAction(original_url, handlers, selected_app_index, | 389 return GetAction(original_url, handlers, selected_app_index, |
| 383 out_url_and_package); | 390 out_url_and_package); |
| 384 } | 391 } |
| 385 | 392 |
| 386 } // namespace arc | 393 } // namespace arc |
| OLD | NEW |