Chromium Code Reviews| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
| 141 // static | 141 // static |
| 142 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | 142 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = |
| 143 rlz_lib::CHROME_OMNIBOX; | 143 rlz_lib::CHROME_OMNIBOX; |
| 144 // static | 144 // static |
| 145 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = | 145 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = |
| 146 rlz_lib::CHROME_HOME_PAGE; | 146 rlz_lib::CHROME_HOME_PAGE; |
| 147 #elif defined(OS_IOS) | |
| 148 // static | |
| 149 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | |
| 150 rlz_lib::CHROME_IOS_OMNIBOX; | |
|
Nico
2013/10/23 16:58:27
Does iOS use this class at all?
| |
| 151 // static | |
| 152 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = | |
| 153 rlz_lib::CHROME_IOS_HOME_PAGE; | |
| 147 #elif defined(OS_MACOSX) | 154 #elif defined(OS_MACOSX) |
| 148 // static | 155 // static |
| 149 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | 156 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = |
| 150 rlz_lib::CHROME_MAC_OMNIBOX; | 157 rlz_lib::CHROME_MAC_OMNIBOX; |
| 151 // static | 158 // static |
| 152 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = | 159 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = |
| 153 rlz_lib::CHROME_MAC_HOME_PAGE; | 160 rlz_lib::CHROME_MAC_HOME_PAGE; |
| 154 #elif defined(OS_CHROMEOS) | 161 #elif defined(OS_CHROMEOS) |
| 155 // static | 162 // static |
| 156 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | 163 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 template_url_service->GetDefaultSearchProvider(); | 228 template_url_service->GetDefaultSearchProvider(); |
| 222 is_google_default_search = | 229 is_google_default_search = |
| 223 url_template && url_template->url_ref().HasGoogleBaseURLs(); | 230 url_template && url_template->url_ref().HasGoogleBaseURLs(); |
| 224 } | 231 } |
| 225 | 232 |
| 226 PrefService* pref_service = profile->GetPrefs(); | 233 PrefService* pref_service = profile->GetPrefs(); |
| 227 bool is_google_homepage = google_util::IsGoogleHomePageUrl( | 234 bool is_google_homepage = google_util::IsGoogleHomePageUrl( |
| 228 GURL(pref_service->GetString(prefs::kHomePage))); | 235 GURL(pref_service->GetString(prefs::kHomePage))); |
| 229 | 236 |
| 230 bool is_google_in_startpages = false; | 237 bool is_google_in_startpages = false; |
| 238 #if !defined(OS_IOS) | |
| 239 // iOS does not have a notion of startpages. | |
| 231 SessionStartupPref session_startup_prefs = | 240 SessionStartupPref session_startup_prefs = |
| 232 StartupBrowserCreator::GetSessionStartupPref( | 241 StartupBrowserCreator::GetSessionStartupPref( |
| 233 *CommandLine::ForCurrentProcess(), profile); | 242 *CommandLine::ForCurrentProcess(), profile); |
| 234 if (session_startup_prefs.type == SessionStartupPref::URLS) { | 243 if (session_startup_prefs.type == SessionStartupPref::URLS) { |
| 235 is_google_in_startpages = | 244 is_google_in_startpages = |
| 236 std::count_if(session_startup_prefs.urls.begin(), | 245 std::count_if(session_startup_prefs.urls.begin(), |
| 237 session_startup_prefs.urls.end(), | 246 session_startup_prefs.urls.end(), |
| 238 google_util::IsGoogleHomePageUrl) > 0; | 247 google_util::IsGoogleHomePageUrl) > 0; |
| 239 } | 248 } |
| 249 #endif | |
| 240 | 250 |
| 241 if (!InitRlzDelayed(first_run, send_ping_immediately, delay, | 251 if (!InitRlzDelayed(first_run, send_ping_immediately, delay, |
| 242 is_google_default_search, is_google_homepage, | 252 is_google_default_search, is_google_homepage, |
| 243 is_google_in_startpages)) { | 253 is_google_in_startpages)) { |
| 244 return false; | 254 return false; |
| 245 } | 255 } |
| 246 | 256 |
| 247 // Prime the RLZ cache for the home page access point so that its avaiable | 257 // Prime the RLZ cache for the home page access point so that its avaiable |
| 248 // for the startup page if needed (i.e., when the startup page is set to | 258 // for the startup page if needed (i.e., when the startup page is set to |
| 249 // the home page). | 259 // the home page). |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 base::AutoLock lock(cache_lock_); | 580 base::AutoLock lock(cache_lock_); |
| 571 rlz_cache_.clear(); | 581 rlz_cache_.clear(); |
| 572 } | 582 } |
| 573 registrar_.RemoveAll(); | 583 registrar_.RemoveAll(); |
| 574 } | 584 } |
| 575 | 585 |
| 576 // static | 586 // static |
| 577 void RLZTracker::EnableZeroDelayForTesting() { | 587 void RLZTracker::EnableZeroDelayForTesting() { |
| 578 GetInstance()->min_init_delay_ = base::TimeDelta(); | 588 GetInstance()->min_init_delay_ = base::TimeDelta(); |
| 579 } | 589 } |
| OLD | NEW |