| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 bool is_google_homepage, | 73 bool is_google_homepage, |
| 74 bool is_google_in_startpages, | 74 bool is_google_in_startpages, |
| 75 bool already_ran, | 75 bool already_ran, |
| 76 bool omnibox_used, | 76 bool omnibox_used, |
| 77 bool homepage_used, | 77 bool homepage_used, |
| 78 bool app_list_used) { | 78 bool app_list_used) { |
| 79 TRACE_EVENT0("RLZ", "RecordProductEvents"); | 79 TRACE_EVENT0("RLZ", "RecordProductEvents"); |
| 80 // Record the installation of chrome. We call this all the time but the rlz | 80 // Record the installation of chrome. We call this all the time but the rlz |
| 81 // lib should ignore all but the first one. | 81 // lib should ignore all but the first one. |
| 82 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 82 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 83 RLZTracker::CHROME_OMNIBOX, | 83 RLZTracker::ChromeOmnibox(), |
| 84 rlz_lib::INSTALL); | 84 rlz_lib::INSTALL); |
| 85 #if !defined(OS_IOS) | 85 #if !defined(OS_IOS) |
| 86 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 86 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 87 RLZTracker::CHROME_HOME_PAGE, | 87 RLZTracker::ChromeHomePage(), |
| 88 rlz_lib::INSTALL); | 88 rlz_lib::INSTALL); |
| 89 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 89 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 90 RLZTracker::CHROME_APP_LIST, | 90 RLZTracker::ChromeAppList(), |
| 91 rlz_lib::INSTALL); | 91 rlz_lib::INSTALL); |
| 92 #endif // !defined(OS_IOS) | 92 #endif // !defined(OS_IOS) |
| 93 | 93 |
| 94 if (!already_ran) { | 94 if (!already_ran) { |
| 95 // Do the initial event recording if is the first run or if we have an | 95 // Do the initial event recording if is the first run or if we have an |
| 96 // empty rlz which means we haven't got a chance to do it. | 96 // empty rlz which means we haven't got a chance to do it. |
| 97 char omnibox_rlz[rlz_lib::kMaxRlzLength + 1]; | 97 char omnibox_rlz[rlz_lib::kMaxRlzLength + 1]; |
| 98 if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, omnibox_rlz, | 98 if (!rlz_lib::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), omnibox_rlz, |
| 99 rlz_lib::kMaxRlzLength)) { | 99 rlz_lib::kMaxRlzLength)) { |
| 100 omnibox_rlz[0] = 0; | 100 omnibox_rlz[0] = 0; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Record if google is the initial search provider and/or home page. | 103 // Record if google is the initial search provider and/or home page. |
| 104 if ((first_run || omnibox_rlz[0] == 0) && is_google_default_search) { | 104 if ((first_run || omnibox_rlz[0] == 0) && is_google_default_search) { |
| 105 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 105 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 106 RLZTracker::CHROME_OMNIBOX, | 106 RLZTracker::ChromeOmnibox(), |
| 107 rlz_lib::SET_TO_GOOGLE); | 107 rlz_lib::SET_TO_GOOGLE); |
| 108 } | 108 } |
| 109 | 109 |
| 110 #if !defined(OS_IOS) | 110 #if !defined(OS_IOS) |
| 111 char homepage_rlz[rlz_lib::kMaxRlzLength + 1]; | 111 char homepage_rlz[rlz_lib::kMaxRlzLength + 1]; |
| 112 if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, homepage_rlz, | 112 if (!rlz_lib::GetAccessPointRlz(RLZTracker::ChromeHomePage(), homepage_rlz, |
| 113 rlz_lib::kMaxRlzLength)) { | 113 rlz_lib::kMaxRlzLength)) { |
| 114 homepage_rlz[0] = 0; | 114 homepage_rlz[0] = 0; |
| 115 } | 115 } |
| 116 | 116 |
| 117 if ((first_run || homepage_rlz[0] == 0) && | 117 if ((first_run || homepage_rlz[0] == 0) && |
| 118 (is_google_homepage || is_google_in_startpages)) { | 118 (is_google_homepage || is_google_in_startpages)) { |
| 119 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 119 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 120 RLZTracker::CHROME_HOME_PAGE, | 120 RLZTracker::ChromeHomePage(), |
| 121 rlz_lib::SET_TO_GOOGLE); | 121 rlz_lib::SET_TO_GOOGLE); |
| 122 } | 122 } |
| 123 | 123 |
| 124 char app_list_rlz[rlz_lib::kMaxRlzLength + 1]; | 124 char app_list_rlz[rlz_lib::kMaxRlzLength + 1]; |
| 125 if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, app_list_rlz, | 125 if (!rlz_lib::GetAccessPointRlz(RLZTracker::ChromeAppList(), app_list_rlz, |
| 126 rlz_lib::kMaxRlzLength)) { | 126 rlz_lib::kMaxRlzLength)) { |
| 127 app_list_rlz[0] = 0; | 127 app_list_rlz[0] = 0; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Record if google is the initial search provider and/or home page. | 130 // Record if google is the initial search provider and/or home page. |
| 131 if ((first_run || app_list_rlz[0] == 0) && is_google_default_search) { | 131 if ((first_run || app_list_rlz[0] == 0) && is_google_default_search) { |
| 132 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 132 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 133 RLZTracker::CHROME_APP_LIST, | 133 RLZTracker::ChromeAppList(), |
| 134 rlz_lib::SET_TO_GOOGLE); | 134 rlz_lib::SET_TO_GOOGLE); |
| 135 } | 135 } |
| 136 #endif // !defined(OS_IOS) | 136 #endif // !defined(OS_IOS) |
| 137 } | 137 } |
| 138 | 138 |
| 139 // Record first user interaction with the omnibox. We call this all the | 139 // Record first user interaction with the omnibox. We call this all the |
| 140 // time but the rlz lib should ingore all but the first one. | 140 // time but the rlz lib should ingore all but the first one. |
| 141 if (omnibox_used) { | 141 if (omnibox_used) { |
| 142 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 142 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 143 RLZTracker::CHROME_OMNIBOX, | 143 RLZTracker::ChromeOmnibox(), |
| 144 rlz_lib::FIRST_SEARCH); | 144 rlz_lib::FIRST_SEARCH); |
| 145 } | 145 } |
| 146 | 146 |
| 147 #if !defined(OS_IOS) | 147 #if !defined(OS_IOS) |
| 148 // Record first user interaction with the home page. We call this all the | 148 // Record first user interaction with the home page. We call this all the |
| 149 // time but the rlz lib should ingore all but the first one. | 149 // time but the rlz lib should ingore all but the first one. |
| 150 if (homepage_used || is_google_in_startpages) { | 150 if (homepage_used || is_google_in_startpages) { |
| 151 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 151 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 152 RLZTracker::CHROME_HOME_PAGE, | 152 RLZTracker::ChromeHomePage(), |
| 153 rlz_lib::FIRST_SEARCH); | 153 rlz_lib::FIRST_SEARCH); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Record first user interaction with the app list. We call this all the | 156 // Record first user interaction with the app list. We call this all the |
| 157 // time but the rlz lib should ingore all but the first one. | 157 // time but the rlz lib should ingore all but the first one. |
| 158 if (app_list_used) { | 158 if (app_list_used) { |
| 159 rlz_lib::RecordProductEvent(rlz_lib::CHROME, | 159 rlz_lib::RecordProductEvent(rlz_lib::CHROME, |
| 160 RLZTracker::CHROME_APP_LIST, | 160 RLZTracker::ChromeAppList(), |
| 161 rlz_lib::FIRST_SEARCH); | 161 rlz_lib::FIRST_SEARCH); |
| 162 } | 162 } |
| 163 #endif // !defined(OS_IOS) | 163 #endif // !defined(OS_IOS) |
| 164 } | 164 } |
| 165 | 165 |
| 166 bool SendFinancialPing(const std::string& brand, | 166 bool SendFinancialPing(const std::string& brand, |
| 167 const base::string16& lang, | 167 const base::string16& lang, |
| 168 const base::string16& referral) { | 168 const base::string16& referral) { |
| 169 rlz_lib::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX, | 169 rlz_lib::AccessPoint points[] = {RLZTracker::ChromeOmnibox(), |
| 170 #if !defined(OS_IOS) | 170 #if !defined(OS_IOS) |
| 171 RLZTracker::CHROME_HOME_PAGE, | 171 RLZTracker::ChromeHomePage(), |
| 172 RLZTracker::CHROME_APP_LIST, | 172 RLZTracker::ChromeAppList(), |
| 173 #endif | 173 #endif |
| 174 rlz_lib::NO_ACCESS_POINT}; | 174 rlz_lib::NO_ACCESS_POINT}; |
| 175 std::string lang_ascii(base::UTF16ToASCII(lang)); | 175 std::string lang_ascii(base::UTF16ToASCII(lang)); |
| 176 std::string referral_ascii(base::UTF16ToASCII(referral)); | 176 std::string referral_ascii(base::UTF16ToASCII(referral)); |
| 177 std::string product_signature; | 177 std::string product_signature; |
| 178 #if defined(OS_CHROMEOS) | 178 #if defined(OS_CHROMEOS) |
| 179 product_signature = "chromeos"; | 179 product_signature = "chromeos"; |
| 180 #else | 180 #else |
| 181 product_signature = "chrome"; | 181 product_signature = "chrome"; |
| 182 #endif | 182 #endif |
| 183 return rlz_lib::SendFinancialPing(rlz_lib::CHROME, points, | 183 return rlz_lib::SendFinancialPing(rlz_lib::CHROME, points, |
| 184 product_signature.c_str(), | 184 product_signature.c_str(), |
| 185 brand.c_str(), referral_ascii.c_str(), | 185 brand.c_str(), referral_ascii.c_str(), |
| 186 lang_ascii.c_str(), false, true); | 186 lang_ascii.c_str(), false, true); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace | 189 } // namespace |
| 190 | 190 |
| 191 #if defined(OS_WIN) | |
| 192 // static | |
| 193 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | |
| 194 rlz_lib::CHROME_OMNIBOX; | |
| 195 // static | |
| 196 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = | |
| 197 rlz_lib::CHROME_HOME_PAGE; | |
| 198 // static | |
| 199 const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST = | |
| 200 rlz_lib::CHROME_APP_LIST; | |
| 201 #elif defined(OS_IOS) | |
| 202 // static | |
| 203 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | |
| 204 rlz_lib::CHROME_IOS_OMNIBOX; | |
| 205 #elif defined(OS_MACOSX) | |
| 206 // static | |
| 207 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | |
| 208 rlz_lib::CHROME_MAC_OMNIBOX; | |
| 209 // static | |
| 210 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = | |
| 211 rlz_lib::CHROME_MAC_HOME_PAGE; | |
| 212 // static | |
| 213 const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST = | |
| 214 rlz_lib::CHROME_MAC_APP_LIST; | |
| 215 #elif defined(OS_CHROMEOS) | |
| 216 // static | |
| 217 const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX = | |
| 218 rlz_lib::CHROMEOS_OMNIBOX; | |
| 219 // static | |
| 220 const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE = | |
| 221 rlz_lib::CHROMEOS_HOME_PAGE; | |
| 222 // static | |
| 223 const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST = | |
| 224 rlz_lib::CHROMEOS_APP_LIST; | |
| 225 #endif | |
| 226 | |
| 227 RLZTracker* RLZTracker::tracker_ = NULL; | 191 RLZTracker* RLZTracker::tracker_ = NULL; |
| 228 | 192 |
| 229 // static | 193 // static |
| 230 RLZTracker* RLZTracker::GetInstance() { | 194 RLZTracker* RLZTracker::GetInstance() { |
| 231 return tracker_ ? tracker_ : Singleton<RLZTracker>::get(); | 195 return tracker_ ? tracker_ : Singleton<RLZTracker>::get(); |
| 232 } | 196 } |
| 233 | 197 |
| 234 RLZTracker::RLZTracker() | 198 RLZTracker::RLZTracker() |
| 235 : first_run_(false), | 199 : first_run_(false), |
| 236 send_ping_immediately_(false), | 200 send_ping_immediately_(false), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (!InitRlzDelayed(first_run, send_ping_immediately, delay, | 260 if (!InitRlzDelayed(first_run, send_ping_immediately, delay, |
| 297 is_google_default_search, is_google_homepage, | 261 is_google_default_search, is_google_homepage, |
| 298 is_google_in_startpages)) { | 262 is_google_in_startpages)) { |
| 299 return false; | 263 return false; |
| 300 } | 264 } |
| 301 | 265 |
| 302 #if !defined(OS_IOS) | 266 #if !defined(OS_IOS) |
| 303 // Prime the RLZ cache for the home page access point so that its avaiable | 267 // Prime the RLZ cache for the home page access point so that its avaiable |
| 304 // for the startup page if needed (i.e., when the startup page is set to | 268 // for the startup page if needed (i.e., when the startup page is set to |
| 305 // the home page). | 269 // the home page). |
| 306 GetAccessPointRlz(CHROME_HOME_PAGE, NULL); | 270 GetAccessPointRlz(ChromeHomePage(), NULL); |
| 307 #endif // !defined(OS_IOS) | 271 #endif // !defined(OS_IOS) |
| 308 | 272 |
| 309 return true; | 273 return true; |
| 310 } | 274 } |
| 311 | 275 |
| 312 bool RLZTracker::Init(bool first_run, | 276 bool RLZTracker::Init(bool first_run, |
| 313 bool send_ping_immediately, | 277 bool send_ping_immediately, |
| 314 base::TimeDelta delay, | 278 base::TimeDelta delay, |
| 315 bool is_google_default_search, | 279 bool is_google_default_search, |
| 316 bool is_google_homepage, | 280 bool is_google_homepage, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 377 |
| 414 if (!IsBrandOrganic(brand_) && SendFinancialPing(brand_, lang, referral)) { | 378 if (!IsBrandOrganic(brand_) && SendFinancialPing(brand_, lang, referral)) { |
| 415 GoogleUpdateSettings::ClearReferral(); | 379 GoogleUpdateSettings::ClearReferral(); |
| 416 | 380 |
| 417 { | 381 { |
| 418 base::AutoLock lock(cache_lock_); | 382 base::AutoLock lock(cache_lock_); |
| 419 rlz_cache_.clear(); | 383 rlz_cache_.clear(); |
| 420 } | 384 } |
| 421 | 385 |
| 422 // Prime the RLZ cache for the access points we are interested in. | 386 // Prime the RLZ cache for the access points we are interested in. |
| 423 GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, NULL); | 387 GetAccessPointRlz(RLZTracker::ChromeOmnibox(), NULL); |
| 424 #if !defined(OS_IOS) | 388 #if !defined(OS_IOS) |
| 425 GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL); | 389 GetAccessPointRlz(RLZTracker::ChromeHomePage(), NULL); |
| 426 GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, NULL); | 390 GetAccessPointRlz(RLZTracker::ChromeAppList(), NULL); |
| 427 #endif // !defined(OS_IOS) | 391 #endif // !defined(OS_IOS) |
| 428 } | 392 } |
| 429 | 393 |
| 430 if (!IsBrandOrganic(reactivation_brand_)) { | 394 if (!IsBrandOrganic(reactivation_brand_)) { |
| 431 rlz_lib::SupplementaryBranding branding(reactivation_brand_.c_str()); | 395 rlz_lib::SupplementaryBranding branding(reactivation_brand_.c_str()); |
| 432 SendFinancialPing(reactivation_brand_, lang, referral); | 396 SendFinancialPing(reactivation_brand_, lang, referral); |
| 433 } | 397 } |
| 434 } | 398 } |
| 435 | 399 |
| 436 bool RLZTracker::SendFinancialPing(const std::string& brand, | 400 bool RLZTracker::SendFinancialPing(const std::string& brand, |
| 437 const base::string16& lang, | 401 const base::string16& lang, |
| 438 const base::string16& referral) { | 402 const base::string16& referral) { |
| 439 return ::SendFinancialPing(brand, lang, referral); | 403 return ::SendFinancialPing(brand, lang, referral); |
| 440 } | 404 } |
| 441 | 405 |
| 442 void RLZTracker::Observe(int type, | 406 void RLZTracker::Observe(int type, |
| 443 const content::NotificationSource& source, | 407 const content::NotificationSource& source, |
| 444 const content::NotificationDetails& details) { | 408 const content::NotificationDetails& details) { |
| 445 switch (type) { | 409 switch (type) { |
| 446 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: | 410 case chrome::NOTIFICATION_OMNIBOX_OPENED_URL: |
| 447 // In M-36, we made NOTIFICATION_OMNIBOX_OPENED_URL fire more often than | 411 // In M-36, we made NOTIFICATION_OMNIBOX_OPENED_URL fire more often than |
| 448 // it did previously. The RLZ folks want RLZ's "first search" detection | 412 // it did previously. The RLZ folks want RLZ's "first search" detection |
| 449 // to remain as unaffected as possible by this change. This test is | 413 // to remain as unaffected as possible by this change. This test is |
| 450 // there to keep the old behavior. | 414 // there to keep the old behavior. |
| 451 if (!content::Details<OmniboxLog>(details).ptr()->is_popup_open) | 415 if (!content::Details<OmniboxLog>(details).ptr()->is_popup_open) |
| 452 break; | 416 break; |
| 453 RecordFirstSearch(CHROME_OMNIBOX); | 417 RecordFirstSearch(ChromeOmnibox()); |
| 454 registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 418 registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 455 content::NotificationService::AllSources()); | 419 content::NotificationService::AllSources()); |
| 456 break; | 420 break; |
| 457 #if !defined(OS_IOS) | 421 #if !defined(OS_IOS) |
| 458 case content::NOTIFICATION_NAV_ENTRY_PENDING: { | 422 case content::NOTIFICATION_NAV_ENTRY_PENDING: { |
| 459 const NavigationEntry* entry = | 423 const NavigationEntry* entry = |
| 460 content::Details<content::NavigationEntry>(details).ptr(); | 424 content::Details<content::NavigationEntry>(details).ptr(); |
| 461 if (entry != NULL && | 425 if (entry != NULL && |
| 462 ((entry->GetTransitionType() & | 426 ((entry->GetTransitionType() & |
| 463 content::PAGE_TRANSITION_HOME_PAGE) != 0)) { | 427 content::PAGE_TRANSITION_HOME_PAGE) != 0)) { |
| 464 RecordFirstSearch(CHROME_HOME_PAGE); | 428 RecordFirstSearch(ChromeHomePage()); |
| 465 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 429 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 466 content::NotificationService::AllSources()); | 430 content::NotificationService::AllSources()); |
| 467 } | 431 } |
| 468 break; | 432 break; |
| 469 } | 433 } |
| 470 #endif // !defined(OS_IOS) | 434 #endif // !defined(OS_IOS) |
| 471 default: | 435 default: |
| 472 NOTREACHED(); | 436 NOTREACHED(); |
| 473 break; | 437 break; |
| 474 } | 438 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // In such case we repost the task on the right thread and return error. | 485 // In such case we repost the task on the right thread and return error. |
| 522 if (ScheduleRecordFirstSearch(point)) | 486 if (ScheduleRecordFirstSearch(point)) |
| 523 return; | 487 return; |
| 524 | 488 |
| 525 bool* record_used = GetAccessPointRecord(point); | 489 bool* record_used = GetAccessPointRecord(point); |
| 526 | 490 |
| 527 // Try to record event now, else set the flag to try later when we | 491 // Try to record event now, else set the flag to try later when we |
| 528 // attempt the ping. | 492 // attempt the ping. |
| 529 if (!RecordProductEvent(rlz_lib::CHROME, point, rlz_lib::FIRST_SEARCH)) | 493 if (!RecordProductEvent(rlz_lib::CHROME, point, rlz_lib::FIRST_SEARCH)) |
| 530 *record_used = true; | 494 *record_used = true; |
| 531 else if (send_ping_immediately_ && point == CHROME_OMNIBOX) | 495 else if (send_ping_immediately_ && point == ChromeOmnibox()) |
| 532 ScheduleDelayedInit(base::TimeDelta()); | 496 ScheduleDelayedInit(base::TimeDelta()); |
| 533 } | 497 } |
| 534 | 498 |
| 535 bool RLZTracker::ScheduleRecordFirstSearch(rlz_lib::AccessPoint point) { | 499 bool RLZTracker::ScheduleRecordFirstSearch(rlz_lib::AccessPoint point) { |
| 536 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) | 500 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) |
| 537 return false; | 501 return false; |
| 538 BrowserThread::GetBlockingPool()->PostSequencedWorkerTaskWithShutdownBehavior( | 502 BrowserThread::GetBlockingPool()->PostSequencedWorkerTaskWithShutdownBehavior( |
| 539 worker_pool_token_, | 503 worker_pool_token_, |
| 540 FROM_HERE, | 504 FROM_HERE, |
| 541 base::Bind(&RLZTracker::RecordFirstSearch, | 505 base::Bind(&RLZTracker::RecordFirstSearch, |
| 542 base::Unretained(this), point), | 506 base::Unretained(this), point), |
| 543 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 507 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 544 return true; | 508 return true; |
| 545 } | 509 } |
| 546 | 510 |
| 547 bool* RLZTracker::GetAccessPointRecord(rlz_lib::AccessPoint point) { | 511 bool* RLZTracker::GetAccessPointRecord(rlz_lib::AccessPoint point) { |
| 548 if (point == CHROME_OMNIBOX) | 512 if (point == ChromeOmnibox()) |
| 549 return &omnibox_used_; | 513 return &omnibox_used_; |
| 550 #if !defined(OS_IOS) | 514 #if !defined(OS_IOS) |
| 551 if (point == CHROME_HOME_PAGE) | 515 if (point == ChromeHomePage()) |
| 552 return &homepage_used_; | 516 return &homepage_used_; |
| 553 if (point == CHROME_APP_LIST) | 517 if (point == ChromeAppList()) |
| 554 return &app_list_used_; | 518 return &app_list_used_; |
| 555 #endif // !defined(OS_IOS) | 519 #endif // !defined(OS_IOS) |
| 556 NOTREACHED(); | 520 NOTREACHED(); |
| 557 return NULL; | 521 return NULL; |
| 558 } | 522 } |
| 559 | 523 |
| 560 // static | 524 // static |
| 561 std::string RLZTracker::GetAccessPointHttpHeader(rlz_lib::AccessPoint point) { | 525 std::string RLZTracker::GetAccessPointHttpHeader(rlz_lib::AccessPoint point) { |
| 562 TRACE_EVENT0("RLZ", "RLZTracker::GetAccessPointHttpHeader"); | 526 TRACE_EVENT0("RLZ", "RLZTracker::GetAccessPointHttpHeader"); |
| 563 std::string extra_headers; | 527 std::string extra_headers; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 } | 625 } |
| 662 | 626 |
| 663 // static | 627 // static |
| 664 void RLZTracker::EnableZeroDelayForTesting() { | 628 void RLZTracker::EnableZeroDelayForTesting() { |
| 665 GetInstance()->min_init_delay_ = base::TimeDelta(); | 629 GetInstance()->min_init_delay_ = base::TimeDelta(); |
| 666 } | 630 } |
| 667 | 631 |
| 668 #if !defined(OS_IOS) | 632 #if !defined(OS_IOS) |
| 669 // static | 633 // static |
| 670 void RLZTracker::RecordAppListSearch() { | 634 void RLZTracker::RecordAppListSearch() { |
| 671 GetInstance()->RecordFirstSearch(RLZTracker::CHROME_APP_LIST); | 635 GetInstance()->RecordFirstSearch(RLZTracker::ChromeAppList()); |
| 672 } | 636 } |
| 673 #endif | 637 #endif |
| OLD | NEW |