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

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: Replacing 'selected' to 'destination', adding a note to the ArcIntentHandlerAction histogram 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 =
378 GetDestinationPlatform(selected_app_package, close_reason);
379 UMA_HISTOGRAM_ENUMERATION("Arc.IntentHandlerDestinationPlatform",
380 static_cast<int>(platform),
381 static_cast<int>(Platform::SIZE));
376 } 382 }
377 383
378 // static 384 // static
385 ArcNavigationThrottle::Platform ArcNavigationThrottle::GetDestinationPlatform(
Yusuke Sato 2016/11/04 00:16:14 * Would you mind adding some unit tests for this?
djacobo_ 2016/11/04 05:53:50 Done.
386 const std::string& selected_app_package,
387 CloseReason close_reason) {
388 return (close_reason != CloseReason::ERROR &&
389 close_reason != CloseReason::DIALOG_DEACTIVATED &&
390 !ArcIntentHelperBridge::IsIntentHelperPackage(selected_app_package))
391 ? Platform::ARC
392 : Platform::CHROME;
393 }
394
395 // static
379 size_t ArcNavigationThrottle::GetAppIndex( 396 size_t ArcNavigationThrottle::GetAppIndex(
380 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 397 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
381 const std::string& selected_app_package) { 398 const std::string& selected_app_package) {
382 for (size_t i = 0; i < handlers.size(); ++i) { 399 for (size_t i = 0; i < handlers.size(); ++i) {
383 if (handlers[i]->package_name == selected_app_package) 400 if (handlers[i]->package_name == selected_app_package)
384 return i; 401 return i;
385 } 402 }
386 return handlers.size(); 403 return handlers.size();
387 } 404 }
388 405
(...skipping 17 matching lines...) Expand all
406 } 423 }
407 424
408 // static 425 // static
409 bool ArcNavigationThrottle::IsSwapElementsNeededForTesting( 426 bool ArcNavigationThrottle::IsSwapElementsNeededForTesting(
410 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 427 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
411 std::pair<size_t, size_t>* out_indices) { 428 std::pair<size_t, size_t>* out_indices) {
412 return IsSwapElementsNeeded(handlers, out_indices); 429 return IsSwapElementsNeeded(handlers, out_indices);
413 } 430 }
414 431
415 } // namespace arc 432 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698