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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 | 563 |
564 // Make sure we don't access disk outside of the I/O thread. | 564 // Make sure we don't access disk outside of the I/O thread. |
565 // In such case we repost the task on the right thread and return error. | 565 // In such case we repost the task on the right thread and return error. |
566 if (ScheduleGetAccessPointRlz(point)) | 566 if (ScheduleGetAccessPointRlz(point)) |
567 return false; | 567 return false; |
568 | 568 |
569 char str_rlz[rlz_lib::kMaxRlzLength + 1]; | 569 char str_rlz[rlz_lib::kMaxRlzLength + 1]; |
570 if (!rlz_lib::GetAccessPointRlz(point, str_rlz, rlz_lib::kMaxRlzLength)) | 570 if (!rlz_lib::GetAccessPointRlz(point, str_rlz, rlz_lib::kMaxRlzLength)) |
571 return false; | 571 return false; |
572 | 572 |
573 base::string16 rlz_local(base::ASCIIToUTF16(std::string(str_rlz))); | 573 base::string16 rlz_local(base::ASCIIToUTF16(str_rlz)); |
574 if (rlz) | 574 if (rlz) |
575 *rlz = rlz_local; | 575 *rlz = rlz_local; |
576 | 576 |
577 base::AutoLock lock(cache_lock_); | 577 base::AutoLock lock(cache_lock_); |
578 rlz_cache_[point] = rlz_local; | 578 rlz_cache_[point] = rlz_local; |
579 return true; | 579 return true; |
580 } | 580 } |
581 | 581 |
582 bool RLZTracker::ScheduleGetAccessPointRlz(rlz_lib::AccessPoint point) { | 582 bool RLZTracker::ScheduleGetAccessPointRlz(rlz_lib::AccessPoint point) { |
583 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) | 583 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) |
(...skipping 46 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 |