| 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 "components/rlz/rlz_tracker.h" | 9 #include "components/rlz/rlz_tracker.h" |
| 10 | 10 |
| 11 #include <algorithm> | 11 #include <algorithm> |
| 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/bind.h" | 14 #include "base/bind.h" |
| 14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 19 #include "components/rlz/rlz_tracker_delegate.h" | 20 #include "components/rlz/rlz_tracker_delegate.h" |
| 20 #include "net/http/http_util.h" | 21 #include "net/http/http_util.h" |
| 21 | 22 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 RLZTracker::~RLZTracker() { | 171 RLZTracker::~RLZTracker() { |
| 171 } | 172 } |
| 172 | 173 |
| 173 // static | 174 // static |
| 174 void RLZTracker::SetRlzDelegate(scoped_ptr<RLZTrackerDelegate> delegate) { | 175 void RLZTracker::SetRlzDelegate(scoped_ptr<RLZTrackerDelegate> delegate) { |
| 175 RLZTracker* tracker = GetInstance(); | 176 RLZTracker* tracker = GetInstance(); |
| 176 if (!tracker->delegate_) { | 177 if (!tracker->delegate_) { |
| 177 // RLZTracker::SetRlzDelegate is called at Profile creation time which can | 178 // RLZTracker::SetRlzDelegate is called at Profile creation time which can |
| 178 // happens multiple time on ChromeOS, so do nothing if the delegate already | 179 // happens multiple time on ChromeOS, so do nothing if the delegate already |
| 179 // exists. | 180 // exists. |
| 180 tracker->SetDelegate(delegate.Pass()); | 181 tracker->SetDelegate(std::move(delegate)); |
| 181 } | 182 } |
| 182 } | 183 } |
| 183 | 184 |
| 184 void RLZTracker::SetDelegate(scoped_ptr<RLZTrackerDelegate> delegate) { | 185 void RLZTracker::SetDelegate(scoped_ptr<RLZTrackerDelegate> delegate) { |
| 185 DCHECK(delegate); | 186 DCHECK(delegate); |
| 186 DCHECK(!delegate_); | 187 DCHECK(!delegate_); |
| 187 delegate_ = delegate.Pass(); | 188 delegate_ = std::move(delegate); |
| 188 worker_pool_token_ = delegate_->GetBlockingPool()->GetSequenceToken(); | 189 worker_pool_token_ = delegate_->GetBlockingPool()->GetSequenceToken(); |
| 189 } | 190 } |
| 190 | 191 |
| 191 // static | 192 // static |
| 192 bool RLZTracker::InitRlzDelayed(bool first_run, | 193 bool RLZTracker::InitRlzDelayed(bool first_run, |
| 193 bool send_ping_immediately, | 194 bool send_ping_immediately, |
| 194 base::TimeDelta delay, | 195 base::TimeDelta delay, |
| 195 bool is_google_default_search, | 196 bool is_google_default_search, |
| 196 bool is_google_homepage, | 197 bool is_google_homepage, |
| 197 bool is_google_in_startpages) { | 198 bool is_google_in_startpages) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 // This method is called during unit tests while the RLZTracker has not been | 558 // This method is called during unit tests while the RLZTracker has not been |
| 558 // initialized, so check for the presence of a delegate and exit if there is | 559 // initialized, so check for the presence of a delegate and exit if there is |
| 559 // none registered. | 560 // none registered. |
| 560 RLZTracker* tracker = GetInstance(); | 561 RLZTracker* tracker = GetInstance(); |
| 561 if (tracker->delegate_) | 562 if (tracker->delegate_) |
| 562 tracker->RecordFirstSearch(RLZTracker::ChromeAppList()); | 563 tracker->RecordFirstSearch(RLZTracker::ChromeAppList()); |
| 563 } | 564 } |
| 564 #endif | 565 #endif |
| 565 | 566 |
| 566 } // namespace rlz | 567 } // namespace rlz |
| OLD | NEW |