| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/search_engines/template_url_service_factory.h" | 30 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/env_vars.h" | 33 #include "chrome/common/env_vars.h" |
| 34 #include "chrome/installer/util/google_update_settings.h" | 34 #include "chrome/installer/util/google_update_settings.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/navigation_entry.h" | 36 #include "content/public/browser/navigation_entry.h" |
| 37 #include "content/public/browser/notification_service.h" | 37 #include "content/public/browser/notification_service.h" |
| 38 | 38 |
| 39 using content::BrowserThread; | 39 using content::BrowserThread; |
| 40 using content::NavigationEntry; |
| 40 | 41 |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 bool IsBrandOrganic(const std::string& brand) { | 44 bool IsBrandOrganic(const std::string& brand) { |
| 44 return brand.empty() || google_util::IsOrganic(brand); | 45 return brand.empty() || google_util::IsOrganic(brand); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void RecordProductEvents(bool first_run, bool google_default_search, | 48 void RecordProductEvents(bool first_run, bool google_default_search, |
| 48 bool google_default_homepage, bool already_ran, | 49 bool google_default_homepage, bool already_ran, |
| 49 bool omnibox_used, bool homepage_used) { | 50 bool omnibox_used, bool homepage_used) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 point = rlz_lib::CHROME_OMNIBOX; | 299 point = rlz_lib::CHROME_OMNIBOX; |
| 299 record_used = &omnibox_used_; | 300 record_used = &omnibox_used_; |
| 300 call_record = true; | 301 call_record = true; |
| 301 | 302 |
| 302 registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 303 registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 303 content::NotificationService::AllSources()); | 304 content::NotificationService::AllSources()); |
| 304 registrar_.Remove(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, | 305 registrar_.Remove(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, |
| 305 content::NotificationService::AllSources()); | 306 content::NotificationService::AllSources()); |
| 306 break; | 307 break; |
| 307 case content::NOTIFICATION_NAV_ENTRY_PENDING: { | 308 case content::NOTIFICATION_NAV_ENTRY_PENDING: { |
| 308 const content::NavigationEntry* entry = | 309 const NavigationEntry* entry = |
| 309 content::Details<content::NavigationEntry>(details).ptr(); | 310 content::Details<NavigationEntry>(details).ptr(); |
| 310 if (entry != NULL && | 311 if (entry != NULL && |
| 311 ((entry->GetTransitionType() & | 312 ((entry->GetTransitionType() & |
| 312 content::PAGE_TRANSITION_HOME_PAGE) != 0)) { | 313 content::PAGE_TRANSITION_HOME_PAGE) != 0)) { |
| 313 point = rlz_lib::CHROME_HOME_PAGE; | 314 point = rlz_lib::CHROME_HOME_PAGE; |
| 314 record_used = &homepage_used_; | 315 record_used = &homepage_used_; |
| 315 call_record = true; | 316 call_record = true; |
| 316 | 317 |
| 317 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 318 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 318 content::NotificationService::AllSources()); | 319 content::NotificationService::AllSources()); |
| 319 } | 320 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 base::IgnoreReturn<bool>( | 402 base::IgnoreReturn<bool>( |
| 402 base::Bind(&RLZTracker::GetAccessPointRlz, point, not_used))); | 403 base::Bind(&RLZTracker::GetAccessPointRlz, point, not_used))); |
| 403 return true; | 404 return true; |
| 404 } | 405 } |
| 405 | 406 |
| 406 // static | 407 // static |
| 407 void RLZTracker::CleanupRlz() { | 408 void RLZTracker::CleanupRlz() { |
| 408 GetInstance()->rlz_cache_.clear(); | 409 GetInstance()->rlz_cache_.clear(); |
| 409 GetInstance()->registrar_.RemoveAll(); | 410 GetInstance()->registrar_.RemoveAll(); |
| 410 } | 411 } |
| OLD | NEW |