OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 virtual void Run() { | 158 virtual void Run() { |
159 // For non-interactive tests we don't do the rest of the initialization | 159 // For non-interactive tests we don't do the rest of the initialization |
160 // because sometimes the very act of loading the dll causes QEMU to crash. | 160 // because sometimes the very act of loading the dll causes QEMU to crash. |
161 if (::GetEnvironmentVariableW(ASCIIToWide(env_vars::kHeadless).c_str(), | 161 if (::GetEnvironmentVariableW(ASCIIToWide(env_vars::kHeadless).c_str(), |
162 NULL, 0)) { | 162 NULL, 0)) { |
163 return; | 163 return; |
164 } | 164 } |
165 // For organic brandcodes do not use rlz at all. Empty brandcode usually | 165 // For organic brandcodes do not use rlz at all. Empty brandcode usually |
166 // means a chromium install. This is ok. | 166 // means a chromium install. This is ok. |
167 std::wstring brand; | 167 std::wstring brand; |
168 GoogleUpdateSettings::GetBrand(&brand); | 168 if (!GoogleUpdateSettings::GetBrand(&brand) || brand.empty() || |
169 if (GoogleUpdateSettings::IsOrganic(brand)) | 169 GoogleUpdateSettings::IsOrganic(brand)) |
170 return; | 170 return; |
171 | 171 |
172 // Do the initial event recording if is the first run or if we have an | 172 // Do the initial event recording if is the first run or if we have an |
173 // empty rlz which means we haven't got a chance to do it. | 173 // empty rlz which means we haven't got a chance to do it. |
174 std::wstring omnibox_rlz; | 174 std::wstring omnibox_rlz; |
175 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &omnibox_rlz); | 175 RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &omnibox_rlz); |
176 | 176 |
177 if (first_run_ || omnibox_rlz.empty()) { | 177 if (first_run_ || omnibox_rlz.empty()) { |
178 // Record the installation of chrome. | 178 // Record the installation of chrome. |
179 RLZTracker::RecordProductEvent(rlz_lib::CHROME, | 179 RLZTracker::RecordProductEvent(rlz_lib::CHROME, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 access_values_state = ACCESS_VALUES_FRESH; | 278 access_values_state = ACCESS_VALUES_FRESH; |
279 cached_ommibox_rlz.assign(*rlz); | 279 cached_ommibox_rlz.assign(*rlz); |
280 } | 280 } |
281 return true; | 281 return true; |
282 } | 282 } |
283 | 283 |
284 // static | 284 // static |
285 void RLZTracker::CleanupRlz() { | 285 void RLZTracker::CleanupRlz() { |
286 OmniBoxUsageObserver::DeleteInstance(); | 286 OmniBoxUsageObserver::DeleteInstance(); |
287 } | 287 } |
OLD | NEW |