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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 1283243002: Add UMA and Rappor metrics to capture URLs passed in at startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/startup/startup_browser_creator_impl.h" 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_restore_service.h" 10 #include "apps/app_restore_service.h"
11 #include "apps/app_restore_service_factory.h" 11 #include "apps/app_restore_service_factory.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/environment.h" 16 #include "base/environment.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram_macros.h"
20 #include "base/metrics/statistics_recorder.h" 20 #include "base/metrics/statistics_recorder.h"
21 #include "base/prefs/pref_service.h" 21 #include "base/prefs/pref_service.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_split.h" 23 #include "base/strings/string_split.h"
24 #include "base/strings/string_util.h" 24 #include "base/strings/string_util.h"
25 #include "base/strings/stringprintf.h" 25 #include "base/strings/stringprintf.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "base/threading/thread_restrictions.h" 27 #include "base/threading/thread_restrictions.h"
28 #include "chrome/browser/apps/install_chrome_app.h" 28 #include "chrome/browser/apps/install_chrome_app.h"
29 #include "chrome/browser/auto_launch_trial.h" 29 #include "chrome/browser/auto_launch_trial.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "chrome/common/chrome_paths.h" 72 #include "chrome/common/chrome_paths.h"
73 #include "chrome/common/chrome_result_codes.h" 73 #include "chrome/common/chrome_result_codes.h"
74 #include "chrome/common/chrome_switches.h" 74 #include "chrome/common/chrome_switches.h"
75 #include "chrome/common/extensions/extension_constants.h" 75 #include "chrome/common/extensions/extension_constants.h"
76 #include "chrome/common/extensions/extension_metrics.h" 76 #include "chrome/common/extensions/extension_metrics.h"
77 #include "chrome/common/pref_names.h" 77 #include "chrome/common/pref_names.h"
78 #include "chrome/common/url_constants.h" 78 #include "chrome/common/url_constants.h"
79 #include "chrome/grit/locale_settings.h" 79 #include "chrome/grit/locale_settings.h"
80 #include "chrome/installer/util/browser_distribution.h" 80 #include "chrome/installer/util/browser_distribution.h"
81 #include "components/google/core/browser/google_util.h" 81 #include "components/google/core/browser/google_util.h"
82 #include "components/rappor/rappor_utils.h"
82 #include "content/public/browser/child_process_security_policy.h" 83 #include "content/public/browser/child_process_security_policy.h"
83 #include "content/public/browser/dom_storage_context.h" 84 #include "content/public/browser/dom_storage_context.h"
84 #include "content/public/browser/notification_observer.h" 85 #include "content/public/browser/notification_observer.h"
85 #include "content/public/browser/notification_registrar.h" 86 #include "content/public/browser/notification_registrar.h"
86 #include "content/public/browser/storage_partition.h" 87 #include "content/public/browser/storage_partition.h"
87 #include "content/public/browser/web_contents.h" 88 #include "content/public/browser/web_contents.h"
88 #include "extensions/browser/extension_prefs.h" 89 #include "extensions/browser/extension_prefs.h"
89 #include "extensions/browser/extension_registry.h" 90 #include "extensions/browser/extension_registry.h"
90 #include "extensions/common/constants.h" 91 #include "extensions/common/constants.h"
91 #include "extensions/common/extension.h" 92 #include "extensions/common/extension.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 welcome_run_type_(WelcomeRunType::NONE) { 319 welcome_run_type_(WelcomeRunType::NONE) {
319 } 320 }
320 321
321 StartupBrowserCreatorImpl::~StartupBrowserCreatorImpl() { 322 StartupBrowserCreatorImpl::~StartupBrowserCreatorImpl() {
322 } 323 }
323 324
324 bool StartupBrowserCreatorImpl::Launch(Profile* profile, 325 bool StartupBrowserCreatorImpl::Launch(Profile* profile,
325 const std::vector<GURL>& urls_to_open, 326 const std::vector<GURL>& urls_to_open,
326 bool process_startup, 327 bool process_startup,
327 chrome::HostDesktopType desktop_type) { 328 chrome::HostDesktopType desktop_type) {
329 UMA_HISTOGRAM_BOOLEAN("Startup.BrowserLaunchWithURLs",
330 !urls_to_open.empty());
Alexei Svitkine (slow) 2015/08/12 18:10:12 If you're adding this, maybe just record the url c
rkaplow 2015/08/12 19:54:18 Done. Probably it's not super necessary but it is
331 RecordRapporOnStartupURLs(urls_to_open);
332
328 DCHECK(profile); 333 DCHECK(profile);
329 profile_ = profile; 334 profile_ = profile;
330 335
331 if (command_line_.HasSwitch(switches::kDnsLogDetails)) 336 if (command_line_.HasSwitch(switches::kDnsLogDetails))
332 chrome_browser_net::EnablePredictorDetailedLog(true); 337 chrome_browser_net::EnablePredictorDetailedLog(true);
333 338
334 if (AppListService::HandleLaunchCommandLine(command_line_, profile)) 339 if (AppListService::HandleLaunchCommandLine(command_line_, profile))
335 return true; 340 return true;
336 341
337 if (command_line_.HasSwitch(switches::kAppId)) { 342 if (command_line_.HasSwitch(switches::kAppId)) {
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 } 1013 }
1009 1014
1010 // Remember that the welcome page was shown for this OS version. 1015 // Remember that the welcome page was shown for this OS version.
1011 local_state->SetString(prefs::kLastWelcomedOSVersion, this_version); 1016 local_state->SetString(prefs::kLastWelcomedOSVersion, this_version);
1012 #else // OS_WIN 1017 #else // OS_WIN
1013 // Show the welcome page as the last tab only on first-run. 1018 // Show the welcome page as the last tab only on first-run.
1014 if (first_run::ShouldShowWelcomePage()) 1019 if (first_run::ShouldShowWelcomePage())
1015 welcome_run_type_ = WelcomeRunType::FIRST_RUN_LAST_TAB; 1020 welcome_run_type_ = WelcomeRunType::FIRST_RUN_LAST_TAB;
1016 #endif // !OS_WIN 1021 #endif // !OS_WIN
1017 } 1022 }
1023
1024 void StartupBrowserCreatorImpl::RecordRapporOnStartupURLs(
1025 const std::vector<GURL>& urls_to_open) {
1026 for (auto& url : urls_to_open) {
Alexei Svitkine (slow) 2015/08/12 18:10:12 Nit: const auto& url or write it out completely -
rkaplow 2015/08/12 19:54:18 Done.
1027 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
1028 "Startup.BrowserLaunchURL", url);
1029 }
1030 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698