| OLD | NEW |
| 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 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work | 5 // This code glues the RLZ library DLL with Chrome. It allows Chrome to work |
| 6 // with or without the DLL being present. If the DLL is not present the | 6 // with or without the DLL being present. If the DLL is not present the |
| 7 // functions do nothing and just return false. | 7 // functions do nothing and just return false. |
| 8 | 8 |
| 9 #include "chrome/browser/rlz/rlz.h" | 9 #include "chrome/browser/rlz/rlz.h" |
| 10 | 10 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 PrefService* pref_service = profile->GetPrefs(); | 244 PrefService* pref_service = profile->GetPrefs(); |
| 245 bool is_google_homepage = google_util::IsGoogleHomePageUrl( | 245 bool is_google_homepage = google_util::IsGoogleHomePageUrl( |
| 246 GURL(pref_service->GetString(prefs::kHomePage))); | 246 GURL(pref_service->GetString(prefs::kHomePage))); |
| 247 | 247 |
| 248 bool is_google_in_startpages = false; | 248 bool is_google_in_startpages = false; |
| 249 #if !defined(OS_IOS) | 249 #if !defined(OS_IOS) |
| 250 // iOS does not have a notion of startpages. | 250 // iOS does not have a notion of startpages. |
| 251 SessionStartupPref session_startup_prefs = | 251 SessionStartupPref session_startup_prefs = |
| 252 StartupBrowserCreator::GetSessionStartupPref( | 252 StartupBrowserCreator::GetSessionStartupPref( |
| 253 *CommandLine::ForCurrentProcess(), profile); | 253 *base::CommandLine::ForCurrentProcess(), profile); |
| 254 if (session_startup_prefs.type == SessionStartupPref::URLS) { | 254 if (session_startup_prefs.type == SessionStartupPref::URLS) { |
| 255 is_google_in_startpages = | 255 is_google_in_startpages = |
| 256 std::count_if(session_startup_prefs.urls.begin(), | 256 std::count_if(session_startup_prefs.urls.begin(), |
| 257 session_startup_prefs.urls.end(), | 257 session_startup_prefs.urls.end(), |
| 258 google_util::IsGoogleHomePageUrl) > 0; | 258 google_util::IsGoogleHomePageUrl) > 0; |
| 259 } | 259 } |
| 260 #endif | 260 #endif |
| 261 | 261 |
| 262 if (!InitRlzDelayed(first_run, send_ping_immediately, delay, | 262 if (!InitRlzDelayed(first_run, send_ping_immediately, delay, |
| 263 is_google_default_search, is_google_homepage, | 263 is_google_default_search, is_google_homepage, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 281 bool is_google_default_search, | 281 bool is_google_default_search, |
| 282 bool is_google_homepage, | 282 bool is_google_homepage, |
| 283 bool is_google_in_startpages) { | 283 bool is_google_in_startpages) { |
| 284 first_run_ = first_run; | 284 first_run_ = first_run; |
| 285 is_google_default_search_ = is_google_default_search; | 285 is_google_default_search_ = is_google_default_search; |
| 286 is_google_homepage_ = is_google_homepage; | 286 is_google_homepage_ = is_google_homepage; |
| 287 is_google_in_startpages_ = is_google_in_startpages; | 287 is_google_in_startpages_ = is_google_in_startpages; |
| 288 send_ping_immediately_ = send_ping_immediately; | 288 send_ping_immediately_ = send_ping_immediately; |
| 289 | 289 |
| 290 // Enable zero delays for testing. | 290 // Enable zero delays for testing. |
| 291 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType)) | 291 if (base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType)) |
| 292 EnableZeroDelayForTesting(); | 292 EnableZeroDelayForTesting(); |
| 293 | 293 |
| 294 delay = std::min(kMaxInitDelay, std::max(min_init_delay_, delay)); | 294 delay = std::min(kMaxInitDelay, std::max(min_init_delay_, delay)); |
| 295 | 295 |
| 296 if (google_brand::GetBrand(&brand_) && !IsBrandOrganic(brand_)) { | 296 if (google_brand::GetBrand(&brand_) && !IsBrandOrganic(brand_)) { |
| 297 // Register for notifications from the omnibox so that we can record when | 297 // Register for notifications from the omnibox so that we can record when |
| 298 // the user performs a first search. | 298 // the user performs a first search. |
| 299 registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 299 registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 300 content::NotificationService::AllSources()); | 300 content::NotificationService::AllSources()); |
| 301 | 301 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 void RLZTracker::EnableZeroDelayForTesting() { | 630 void RLZTracker::EnableZeroDelayForTesting() { |
| 631 GetInstance()->min_init_delay_ = base::TimeDelta(); | 631 GetInstance()->min_init_delay_ = base::TimeDelta(); |
| 632 } | 632 } |
| 633 | 633 |
| 634 #if !defined(OS_IOS) | 634 #if !defined(OS_IOS) |
| 635 // static | 635 // static |
| 636 void RLZTracker::RecordAppListSearch() { | 636 void RLZTracker::RecordAppListSearch() { |
| 637 GetInstance()->RecordFirstSearch(RLZTracker::ChromeAppList()); | 637 GetInstance()->RecordFirstSearch(RLZTracker::ChromeAppList()); |
| 638 } | 638 } |
| 639 #endif | 639 #endif |
| OLD | NEW |