OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/rlz/chrome_rlz_tracker_delegate.h" | 5 #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/google/google_brand.h" | 12 #include "chrome/browser/google/google_brand.h" |
13 #include "chrome/browser/prefs/session_startup_pref.h" | 13 #include "chrome/browser/prefs/session_startup_pref.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 15 #include "chrome/browser/search_engines/template_url_service_factory.h" |
16 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 16 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "components/google/core/browser/google_util.h" | 19 #include "components/google/core/browser/google_util.h" |
20 #include "components/omnibox/browser/omnibox_log.h" | 20 #include "components/omnibox/browser/omnibox_log.h" |
| 21 #include "components/pref_registry/pref_registry_syncable.h" |
21 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
22 #include "components/search_engines/template_url.h" | 23 #include "components/search_engines/template_url.h" |
23 #include "components/search_engines/template_url_service.h" | 24 #include "components/search_engines/template_url_service.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
26 #include "content/public/browser/navigation_details.h" | 27 #include "content/public/browser/navigation_details.h" |
27 #include "content/public/browser/navigation_entry.h" | 28 #include "content/public/browser/navigation_entry.h" |
28 #include "content/public/browser/notification_details.h" | 29 #include "content/public/browser/notification_details.h" |
29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
30 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
31 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "rlz/features/features.h" |
32 | 34 |
33 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
34 #include "chrome/installer/util/google_update_settings.h" | 36 #include "chrome/installer/util/google_update_settings.h" |
35 #endif | 37 #endif |
36 | 38 |
37 ChromeRLZTrackerDelegate::ChromeRLZTrackerDelegate() { | 39 ChromeRLZTrackerDelegate::ChromeRLZTrackerDelegate() { |
38 } | 40 } |
39 | 41 |
40 ChromeRLZTrackerDelegate::~ChromeRLZTrackerDelegate() { | 42 ChromeRLZTrackerDelegate::~ChromeRLZTrackerDelegate() { |
41 } | 43 } |
42 | 44 |
43 // static | 45 // static |
| 46 void ChromeRLZTrackerDelegate::RegisterProfilePrefs( |
| 47 user_prefs::PrefRegistrySyncable* registry) { |
| 48 #if BUILDFLAG(ENABLE_RLZ) |
| 49 registry->RegisterIntegerPref(prefs::kRlzPingDelaySeconds, 90); |
| 50 #endif |
| 51 } |
| 52 |
| 53 // static |
44 bool ChromeRLZTrackerDelegate::IsGoogleDefaultSearch(Profile* profile) { | 54 bool ChromeRLZTrackerDelegate::IsGoogleDefaultSearch(Profile* profile) { |
45 bool is_google_default_search = false; | 55 bool is_google_default_search = false; |
46 TemplateURLService* template_url_service = | 56 TemplateURLService* template_url_service = |
47 TemplateURLServiceFactory::GetForProfile(profile); | 57 TemplateURLServiceFactory::GetForProfile(profile); |
48 if (template_url_service) { | 58 if (template_url_service) { |
49 const TemplateURL* url_template = | 59 const TemplateURL* url_template = |
50 template_url_service->GetDefaultSearchProvider(); | 60 template_url_service->GetDefaultSearchProvider(); |
51 is_google_default_search = url_template && | 61 is_google_default_search = url_template && |
52 url_template->url_ref().HasGoogleBaseURLs( | 62 url_template->url_ref().HasGoogleBaseURLs( |
53 template_url_service->search_terms_data()); | 63 template_url_service->search_terms_data()); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // to remain as unaffected as possible by this change. This test is | 236 // to remain as unaffected as possible by this change. This test is |
227 // there to keep the old behavior. | 237 // there to keep the old behavior. |
228 if (!log->is_popup_open) | 238 if (!log->is_popup_open) |
229 return; | 239 return; |
230 | 240 |
231 omnibox_url_opened_subscription_.reset(); | 241 omnibox_url_opened_subscription_.reset(); |
232 base::Closure omnibox_callback; | 242 base::Closure omnibox_callback; |
233 swap(omnibox_callback, on_omnibox_search_callback_); | 243 swap(omnibox_callback, on_omnibox_search_callback_); |
234 omnibox_callback.Run(); | 244 omnibox_callback.Run(); |
235 } | 245 } |
OLD | NEW |