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

Unified Diff: chrome/browser/chromeos/arc/arc_navigation_throttle.cc

Issue 2092253002: Record UMA in ArcNavigationThrottle::OnDisambigDialogClosed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 months 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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/arc_navigation_throttle.cc
diff --git a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
index e63e77f4aae133af43bd5b4716a1e21783c64af1..3e3a3abe8a00cdb53d13b0997a9b216add21a3dc 100644
--- a/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
+++ b/chrome/browser/chromeos/arc/arc_navigation_throttle.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "base/metrics/histogram_macros.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_service_manager.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
@@ -110,7 +111,7 @@ void ArcNavigationThrottle::OnAppCandidatesReceived(
<< navigation_handle()->GetURL().spec();
}
OnDisambigDialogClosed(std::move(handlers), i,
- CloseReason::REASON_PREFERRED_ACTIVITY_FOUND);
+ CloseReason::PREFERRED_ACTIVITY_FOUND);
return;
}
@@ -163,34 +164,47 @@ void ArcNavigationThrottle::OnDisambigDialogClosed(
const GURL& url = navigation_handle()->GetURL();
content::NavigationHandle* handle = navigation_handle();
- // TODO(djacobo): Record UMA
- // If the user fails to select an option from the list, or the UI returned an
- // error or if |selected_app_index| is not a valid index, then resume the
- // navigation in Chrome. Otherwise store the preferred app (if any) and start
- // the selected app, either Chrome Browser or ARC app.
- if (close_reason == CloseReason::REASON_DIALOG_DEACTIVATED ||
- close_reason == CloseReason::REASON_ERROR ||
- selected_app_index >= handlers.size()) {
- DVLOG(1) << "User didn't select a valid option, resuming navigation.";
- handle->Resume();
- return;
- }
mojom::IntentHelperInstance* bridge = GetIntentHelper();
- if (!bridge) {
- handle->Resume();
- return;
+ if (!bridge || selected_app_index >= handlers.size()) {
+ close_reason = CloseReason::ERROR;
}
- if (close_reason == CloseReason::REASON_ALWAYS_PRESSED) {
- bridge->AddPreferredPackage(handlers[selected_app_index]->package_name);
- }
- if (ArcIntentHelperBridge::IsIntentHelperPackage(
- handlers[selected_app_index]->package_name)) {
- handle->Resume();
- return;
+
+ switch (close_reason) {
+ case CloseReason::ERROR:
+ case CloseReason::DIALOG_DEACTIVATED: {
+ // If the user fails to select an option from the list, or the UI returned
+ // an error or if |selected_app_index| is not a valid index, then resume
+ // the navigation in Chrome.
+ DVLOG(1) << "User didn't select a valid option, resuming navigation.";
+ handle->Resume();
+ break;
+ }
+ case CloseReason::ALWAYS_PRESSED: {
+ bridge->AddPreferredPackage(handlers[selected_app_index]->package_name);
+ // fall through.
+ }
+ case CloseReason::JUST_ONCE_PRESSED:
+ case CloseReason::PREFERRED_ACTIVITY_FOUND: {
+ if (ArcIntentHelperBridge::IsIntentHelperPackage(
+ handlers[selected_app_index]->package_name)) {
+ handle->Resume();
+ } else {
+ bridge->HandleUrl(url.spec(),
+ handlers[selected_app_index]->package_name);
+ handle->CancelDeferredNavigation(
+ content::NavigationThrottle::CANCEL_AND_IGNORE);
+ }
+ break;
+ }
+ case CloseReason::SIZE: {
+ NOTREACHED();
+ return;
+ }
}
- bridge->HandleUrl(url.spec(), handlers[selected_app_index]->package_name);
- handle->CancelDeferredNavigation(
- content::NavigationThrottle::CANCEL_AND_IGNORE);
+
+ UMA_HISTOGRAM_ENUMERATION("Arc.IntentHandlerAction",
+ static_cast<int>(close_reason),
+ static_cast<int>(CloseReason::SIZE));
}
} // namespace arc
« no previous file with comments | « chrome/browser/chromeos/arc/arc_navigation_throttle.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698