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

Unified Diff: chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc

Issue 2443313002: Add more tests to arc_navigation_throttle.cc (Closed)
Patch Set: address comments Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_navigation_throttle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc
diff --git a/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc b/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc
index 35157fd48b9e967d486ac1c389132da9e8239b80..fe7e24357a967dd7c52deeaccde47bb9eb202d96 100644
--- a/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc
+++ b/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc
@@ -74,7 +74,10 @@ void OnIntentPickerClosed(int render_process_host_id,
ArcNavigationThrottle::CloseReason close_reason) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- size_t selected_app_index = handlers.size();
+ // If the user selected an app to continue the navigation, confirm that the
+ // |package_name| matches a valid option and return the index.
+ const size_t selected_app_index =
+ ArcNavigationThrottle::GetAppIndex(handlers, selected_app_package);
// Make sure that the instance at least supports HandleUrl.
auto* instance = ArcIntentHelperBridge::GetIntentHelperInstance(
"HandleUrl", kMinVersionForHandleUrl);
@@ -84,15 +87,6 @@ void OnIntentPickerClosed(int render_process_host_id,
ArcNavigationThrottle::CloseReason::JUST_ONCE_PRESSED ||
close_reason ==
ArcNavigationThrottle::CloseReason::ALWAYS_PRESSED) {
- // If the user selected an app to continue the navigation, confirm that the
- // |package_name| matches a valid option and return the index.
- for (size_t i = 0; i < handlers.size(); ++i) {
- if (handlers[i]->package_name == selected_app_package) {
- selected_app_index = i;
- break;
- }
- }
-
if (selected_app_index == handlers.size())
close_reason = ArcNavigationThrottle::CloseReason::ERROR;
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_navigation_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698