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

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

Issue 2478923002: Ensure that Chrome is visible in the dialog by default (Closed)
Patch Set: address review comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/intent_helper/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/intent_helper/arc_external_protocol_dialog.cc
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
index d2fe421f4839202f1bebea1710055657239c34aa..11be10a41ede9d3fe32fb052f65054b18d93dfe6 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_external_protocol_dialog.cc
@@ -329,7 +329,15 @@ void OnUrlHandlerList(int render_process_host_id,
return; // the |url| has been handled.
}
- // Otherwise, retrieve icons of the activities.
+ // Otherwise, retrieve icons of the activities. First, swap |handler| elements
+ // to ensure Chrome is visible in the UI by default. Since this function is
+ // for handling external protocols, Chrome is rarely in the list, but if the
+ // |url| is intent: with fallback or geo:, for example, it may be.
+ std::pair<size_t, size_t> indices;
+ if (ArcNavigationThrottle::IsSwapElementsNeeded(handlers, &indices))
+ std::swap(handlers[indices.first], handlers[indices.second]);
+
+ // Then request the icons.
std::vector<ActivityIconLoader::ActivityName> activities;
for (const auto& handler : handlers) {
activities.emplace_back(handler->package_name, handler->activity_name);
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698