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

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: review 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
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 322
323 // Check if the |url| should be handled right away without showing the UI. 323 // Check if the |url| should be handled right away without showing the UI.
324 GetActionResult result; 324 GetActionResult result;
325 if (HandleUrl(render_process_host_id, routing_id, url, handlers, 325 if (HandleUrl(render_process_host_id, routing_id, url, handlers,
326 handlers.size(), &result)) { 326 handlers.size(), &result)) {
327 if (result == GetActionResult::HANDLE_URL_IN_ARC) 327 if (result == GetActionResult::HANDLE_URL_IN_ARC)
328 RecordUma(ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND); 328 RecordUma(ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND);
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 not visible in the UI by defalult. Since This function
djacobo_ 2016/11/05 04:49:21 "to ensure Chrome IS visible..." , right?
Yusuke Sato 2016/11/07 17:11:36 oops, good catch. Fixed.
334 // is for handling external protocols, Chrome is rarely in the list, but if
335 // the |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

Powered by Google App Engine
This is Rietveld 408576698