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

Unified Diff: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.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
Index: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
index d868bee14d945b8c6ce500011a1565e6bef7150b..09a26a476db2e7a882167b81030aaf0062e9ba95 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc
@@ -95,29 +95,6 @@ size_t FindPreferredApp(
return handlers.size(); // not found
}
-// Swaps Chrome app with any app in row |kMaxAppResults-1| iff its index is
-// bigger, thus ensuring the user can always see Chrome without scrolling.
-// When swap is needed, fills |out_indices| and returns true. If |handlers|
-// do not have Chrome, returns false.
-bool IsSwapElementsNeeded(
- const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
- std::pair<size_t, size_t>* out_indices) {
- size_t chrome_app_index = 0;
- for (size_t i = 0; i < handlers.size(); ++i) {
- if (ArcIntentHelperBridge::IsIntentHelperPackage(
- handlers[i]->package_name)) {
- chrome_app_index = i;
- break;
- }
- }
- if (chrome_app_index < ArcNavigationThrottle::kMaxAppResults)
- return false;
-
- *out_indices = std::make_pair(ArcNavigationThrottle::kMaxAppResults - 1,
- chrome_app_index);
- return true;
-}
-
} // namespace
ArcNavigationThrottle::ArcNavigationThrottle(
@@ -429,10 +406,23 @@ size_t ArcNavigationThrottle::FindPreferredAppForTesting(
}
// static
-bool ArcNavigationThrottle::IsSwapElementsNeededForTesting(
+bool ArcNavigationThrottle::IsSwapElementsNeeded(
const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
std::pair<size_t, size_t>* out_indices) {
- return IsSwapElementsNeeded(handlers, out_indices);
+ size_t chrome_app_index = 0;
+ for (size_t i = 0; i < handlers.size(); ++i) {
+ if (ArcIntentHelperBridge::IsIntentHelperPackage(
+ handlers[i]->package_name)) {
+ chrome_app_index = i;
+ break;
+ }
+ }
+ if (chrome_app_index < ArcNavigationThrottle::kMaxAppResults)
+ return false;
+
+ *out_indices = std::make_pair(ArcNavigationThrottle::kMaxAppResults - 1,
+ chrome_app_index);
+ return true;
}
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698