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

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

Issue 2476783002: Adding a destination platform histogram for UMA. (Closed)
Patch Set: Style fixes, git cl lint/format 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 22 matching lines...) Expand all
33 using content::WebContents; 33 using content::WebContents;
34 34
35 namespace arc { 35 namespace arc {
36 36
37 namespace { 37 namespace {
38 38
39 constexpr uint32_t kMinVersionForHandleUrl = 2; 39 constexpr uint32_t kMinVersionForHandleUrl = 2;
40 constexpr uint32_t kMinVersionForRequestUrlHandlerList = 2; 40 constexpr uint32_t kMinVersionForRequestUrlHandlerList = 2;
41 constexpr uint32_t kMinVersionForAddPreferredPackage = 7; 41 constexpr uint32_t kMinVersionForAddPreferredPackage = 7;
42 42
43 void RecordUma(ArcNavigationThrottle::CloseReason close_reason) { 43 void RecordUma(ArcNavigationThrottle::CloseReason close_reason,
44 ArcNavigationThrottle::Platform platform) {
44 UMA_HISTOGRAM_ENUMERATION( 45 UMA_HISTOGRAM_ENUMERATION(
45 "Arc.IntentHandlerAction", static_cast<int>(close_reason), 46 "Arc.IntentHandlerAction", static_cast<int>(close_reason),
46 static_cast<int>(ArcNavigationThrottle::CloseReason::SIZE)); 47 static_cast<int>(ArcNavigationThrottle::CloseReason::SIZE));
48
49 UMA_HISTOGRAM_ENUMERATION(
50 "Arc.IntentHandlerDestinationPlatform", static_cast<int>(platform),
51 static_cast<int>(ArcNavigationThrottle::Platform::SIZE));
Ilya Sherman 2016/11/05 01:39:22 nit: Are these static casts needed? I thought I r
Ilya Sherman 2016/11/05 01:39:22 It looks like you emit this same histogram both he
djacobo_ 2016/11/05 04:24:53 True, very nice catch. Done.
djacobo_ 2016/11/05 04:24:53 didnt work :'( could revisit later.
47 } 52 }
48 53
49 // Shows the Chrome OS' original external protocol dialog as a fallback. 54 // Shows the Chrome OS' original external protocol dialog as a fallback.
50 void ShowFallbackExternalProtocolDialog(int render_process_host_id, 55 void ShowFallbackExternalProtocolDialog(int render_process_host_id,
51 int routing_id, 56 int routing_id,
52 const GURL& url) { 57 const GURL& url) {
53 WebContents* web_contents = 58 WebContents* web_contents =
54 tab_util::GetWebContentsByID(render_process_host_id, routing_id); 59 tab_util::GetWebContentsByID(render_process_host_id, routing_id);
55 new ExternalProtocolDialog(web_contents, url); 60 new ExternalProtocolDialog(web_contents, url);
56 } 61 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 << ", handlers.size=" << handlers.size(); 269 << ", handlers.size=" << handlers.size();
265 // fall through. 270 // fall through.
266 } 271 }
267 case ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED: { 272 case ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED: {
268 // The user didn't select any ARC activity. Show the Chrome OS dialog. 273 // The user didn't select any ARC activity. Show the Chrome OS dialog.
269 ShowFallbackExternalProtocolDialog(render_process_host_id, routing_id, 274 ShowFallbackExternalProtocolDialog(render_process_host_id, routing_id,
270 url); 275 url);
271 break; 276 break;
272 } 277 }
273 } 278 }
274 RecordUma(close_reason); 279
280 ArcNavigationThrottle::Platform platform =
281 ArcNavigationThrottle::GetDestinationPlatform(selected_app_package,
282 close_reason);
283 RecordUma(close_reason, platform);
275 } 284 }
276 285
277 // Called when ARC returned activity icons for the |handlers|. 286 // Called when ARC returned activity icons for the |handlers|.
278 void OnAppIconsReceived( 287 void OnAppIconsReceived(
279 int render_process_host_id, 288 int render_process_host_id,
280 int routing_id, 289 int routing_id,
281 const GURL& url, 290 const GURL& url,
282 mojo::Array<mojom::IntentHandlerInfoPtr> handlers, 291 mojo::Array<mojom::IntentHandlerInfoPtr> handlers,
283 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons) { 292 std::unique_ptr<ActivityIconLoader::ActivityToIconsMap> icons) {
284 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 293 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 if (!instance || !icon_loader) { 326 if (!instance || !icon_loader) {
318 // ARC is not running anymore. Show the Chrome OS dialog. 327 // ARC is not running anymore. Show the Chrome OS dialog.
319 ShowFallbackExternalProtocolDialog(render_process_host_id, routing_id, url); 328 ShowFallbackExternalProtocolDialog(render_process_host_id, routing_id, url);
320 return; 329 return;
321 } 330 }
322 331
323 // Check if the |url| should be handled right away without showing the UI. 332 // Check if the |url| should be handled right away without showing the UI.
324 GetActionResult result; 333 GetActionResult result;
325 if (HandleUrl(render_process_host_id, routing_id, url, handlers, 334 if (HandleUrl(render_process_host_id, routing_id, url, handlers,
326 handlers.size(), &result)) { 335 handlers.size(), &result)) {
327 if (result == GetActionResult::HANDLE_URL_IN_ARC) 336 if (result == GetActionResult::HANDLE_URL_IN_ARC) {
328 RecordUma(ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND); 337 RecordUma(ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND,
338 ArcNavigationThrottle::Platform::ARC);
339 }
329 return; // the |url| has been handled. 340 return; // the |url| has been handled.
330 } 341 }
331 342
332 // Otherwise, retrieve icons of the activities. 343 // Otherwise, retrieve icons of the activities.
333 std::vector<ActivityIconLoader::ActivityName> activities; 344 std::vector<ActivityIconLoader::ActivityName> activities;
334 for (const auto& handler : handlers) { 345 for (const auto& handler : handlers) {
335 activities.emplace_back(handler->package_name, handler->activity_name); 346 activities.emplace_back(handler->package_name, handler->activity_name);
336 } 347 }
337 icon_loader->GetActivityIcons( 348 icon_loader->GetActivityIcons(
338 activities, base::Bind(OnAppIconsReceived, render_process_host_id, 349 activities, base::Bind(OnAppIconsReceived, render_process_host_id,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 GetActionResult GetActionForTesting( 404 GetActionResult GetActionForTesting(
394 const GURL& original_url, 405 const GURL& original_url,
395 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers, 406 const mojo::Array<mojom::IntentHandlerInfoPtr>& handlers,
396 size_t selected_app_index, 407 size_t selected_app_index,
397 std::pair<GURL, std::string>* out_url_and_package) { 408 std::pair<GURL, std::string>* out_url_and_package) {
398 return GetAction(original_url, handlers, selected_app_index, 409 return GetAction(original_url, handlers, selected_app_index,
399 out_url_and_package); 410 out_url_and_package);
400 } 411 }
401 412
402 } // namespace arc 413 } // 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