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

Side by Side Diff: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.cc

Issue 2476783002: Adding a destination platform histogram for UMA. (Closed)
Patch Set: 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_navigation_throttle.h" 5 #include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 366 }
367 case CloseReason::INVALID: { 367 case CloseReason::INVALID: {
368 NOTREACHED(); 368 NOTREACHED();
369 return; 369 return;
370 } 370 }
371 } 371 }
372 372
373 UMA_HISTOGRAM_ENUMERATION("Arc.IntentHandlerAction", 373 UMA_HISTOGRAM_ENUMERATION("Arc.IntentHandlerAction",
374 static_cast<int>(close_reason), 374 static_cast<int>(close_reason),
375 static_cast<int>(CloseReason::SIZE)); 375 static_cast<int>(CloseReason::SIZE));
376
377 Platform platform = GetSelectedPlatform(selected_app_package, close_reason);
378 UMA_HISTOGRAM_ENUMERATION("Arc.IntentHandlerSelectedPlatform",
379 static_cast<int>(platform),
380 static_cast<int>(Platform::SIZE));
376 } 381 }
377 382
378 // static 383 // static
384 ArcNavigationThrottle::Platform ArcNavigationThrottle::GetSelectedPlatform(
385 const std::string& selected_app_package,
386 CloseReason close_reason) {
387 return (close_reason != CloseReason::ERROR &&
388 close_reason != CloseReason::DIALOG_DEACTIVATED &&
389 !ArcIntentHelperBridge::IsIntentHelperPackage(selected_app_package))
390 ? Platform::ARC
391 : Platform::CHROME;
392 }
393
394 // static
379 size_t ArcNavigationThrottle::GetAppIndex( 395 size_t ArcNavigationThrottle::GetAppIndex(
380 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 396 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
381 const std::string& selected_app_package) { 397 const std::string& selected_app_package) {
382 for (size_t i = 0; i < handlers.size(); ++i) { 398 for (size_t i = 0; i < handlers.size(); ++i) {
383 if (handlers[i]->package_name == selected_app_package) 399 if (handlers[i]->package_name == selected_app_package)
384 return i; 400 return i;
385 } 401 }
386 return handlers.size(); 402 return handlers.size();
387 } 403 }
388 404
(...skipping 17 matching lines...) Expand all
406 } 422 }
407 423
408 // static 424 // static
409 bool ArcNavigationThrottle::IsSwapElementsNeededForTesting( 425 bool ArcNavigationThrottle::IsSwapElementsNeededForTesting(
410 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 426 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
411 std::pair<size_t, size_t>* out_indices) { 427 std::pair<size_t, size_t>* out_indices) {
412 return IsSwapElementsNeeded(handlers, out_indices); 428 return IsSwapElementsNeeded(handlers, out_indices);
413 } 429 }
414 430
415 } // namespace arc 431 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698