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

Side by Side 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 unified diff | 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 »
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/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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 if (HandleUrl(render_process_host_id, routing_id, url, handlers, 322 if (HandleUrl(render_process_host_id, routing_id, url, handlers,
323 handlers.size(), &result)) { 323 handlers.size(), &result)) {
324 if (result == GetActionResult::HANDLE_URL_IN_ARC) { 324 if (result == GetActionResult::HANDLE_URL_IN_ARC) {
325 ArcNavigationThrottle::RecordUma( 325 ArcNavigationThrottle::RecordUma(
326 ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND, 326 ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND,
327 ArcNavigationThrottle::Platform::ARC); 327 ArcNavigationThrottle::Platform::ARC);
328 } 328 }
329 return; // the |url| has been handled. 329 return; // the |url| has been handled.
330 } 330 }
331 331
332 // Otherwise, retrieve icons of the activities. 332 // Otherwise, retrieve icons of the activities. First, swap |handler| elements
333 // to ensure Chrome is visible in the UI by default. Since this function is
334 // for handling external protocols, Chrome is rarely in the list, but if the
335 // |url| is intent: with fallback or geo:, for example, it may be.
336 std::pair<size_t, size_t> indices;
337 if (ArcNavigationThrottle::IsSwapElementsNeeded(handlers, &indices))
338 std::swap(handlers[indices.first], handlers[indices.second]);
339
340 // Then request the icons.
333 std::vector<ActivityIconLoader::ActivityName> activities; 341 std::vector<ActivityIconLoader::ActivityName> activities;
334 for (const auto& handler : handlers) { 342 for (const auto& handler : handlers) {
335 activities.emplace_back(handler->package_name, handler->activity_name); 343 activities.emplace_back(handler->package_name, handler->activity_name);
336 } 344 }
337 icon_loader->GetActivityIcons( 345 icon_loader->GetActivityIcons(
338 activities, base::Bind(OnAppIconsReceived, render_process_host_id, 346 activities, base::Bind(OnAppIconsReceived, render_process_host_id,
339 routing_id, url, base::Passed(&handlers))); 347 routing_id, url, base::Passed(&handlers)));
340 } 348 }
341 349
342 // Returns true if ARC should ignore the navigation with the |page_transition|. 350 // Returns true if ARC should ignore the navigation with the |page_transition|.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 GetActionResult GetActionForTesting( 401 GetActionResult GetActionForTesting(
394 const GURL& original_url, 402 const GURL& original_url,
395 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 403 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
396 size_t selected_app_index, 404 size_t selected_app_index,
397 std::pair<GURL, std::string>* out_url_and_package) { 405 std::pair<GURL, std::string>* out_url_and_package) {
398 return GetAction(original_url, handlers, selected_app_index, 406 return GetAction(original_url, handlers, selected_app_index,
399 out_url_and_package); 407 out_url_and_package);
400 } 408 }
401 409
402 } // namespace arc 410 } // namespace arc
OLDNEW
« 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