| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED). | 189 // typing in the omnibox (which triggers INSTANT_CONTROLLER_UPDATED). |
| 190 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, | 190 registrar_.Add(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, |
| 191 NotificationService::AllSources()); | 191 NotificationService::AllSources()); |
| 192 | 192 |
| 193 // Register for notifications from navigations, to see if the user has used | 193 // Register for notifications from navigations, to see if the user has used |
| 194 // the home page. | 194 // the home page. |
| 195 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 195 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 196 NotificationService::AllSources()); | 196 NotificationService::AllSources()); |
| 197 | 197 |
| 198 ScheduleDelayedInit(delay); | 198 ScheduleDelayedInit(delay); |
| 199 |
| 199 return true; | 200 return true; |
| 200 } | 201 } |
| 201 | 202 |
| 202 void RLZTracker::ScheduleDelayedInit(int delay) { | 203 void RLZTracker::ScheduleDelayedInit(int delay) { |
| 203 BrowserThread::PostDelayedTask( | 204 BrowserThread::PostDelayedTask( |
| 204 BrowserThread::FILE, | 205 BrowserThread::FILE, |
| 205 FROM_HERE, | 206 FROM_HERE, |
| 206 NewRunnableMethod(this, &RLZTracker::DelayedInit), | 207 NewRunnableMethod(this, &RLZTracker::DelayedInit), |
| 207 delay); | 208 delay); |
| 208 } | 209 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 call_record = true; | 289 call_record = true; |
| 289 | 290 |
| 290 registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 291 registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 291 NotificationService::AllSources()); | 292 NotificationService::AllSources()); |
| 292 registrar_.Remove(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, | 293 registrar_.Remove(this, chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED, |
| 293 NotificationService::AllSources()); | 294 NotificationService::AllSources()); |
| 294 break; | 295 break; |
| 295 case content::NOTIFICATION_NAV_ENTRY_PENDING: { | 296 case content::NOTIFICATION_NAV_ENTRY_PENDING: { |
| 296 const NavigationEntry* entry = Details<NavigationEntry>(details).ptr(); | 297 const NavigationEntry* entry = Details<NavigationEntry>(details).ptr(); |
| 297 if (entry != NULL && | 298 if (entry != NULL && |
| 298 ((entry->transition_type() & RLZ_PAGETRANSITION_HOME_PAGE) != 0)) { | 299 ((entry->transition_type() & PageTransition::HOME_PAGE) != 0)) { |
| 299 point = rlz_lib::CHROME_HOME_PAGE; | 300 point = rlz_lib::CHROME_HOME_PAGE; |
| 300 record_used = &homepage_used_; | 301 record_used = &homepage_used_; |
| 301 call_record = true; | 302 call_record = true; |
| 302 | 303 |
| 303 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, | 304 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_PENDING, |
| 304 NotificationService::AllSources()); | 305 NotificationService::AllSources()); |
| 305 } | 306 } |
| 306 break; | 307 break; |
| 307 } | 308 } |
| 308 default: | 309 default: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 BrowserThread::FILE, FROM_HERE, | 386 BrowserThread::FILE, FROM_HERE, |
| 386 NewRunnableFunction(&RLZTracker::GetAccessPointRlz, point, not_used)); | 387 NewRunnableFunction(&RLZTracker::GetAccessPointRlz, point, not_used)); |
| 387 return true; | 388 return true; |
| 388 } | 389 } |
| 389 | 390 |
| 390 // static | 391 // static |
| 391 void RLZTracker::CleanupRlz() { | 392 void RLZTracker::CleanupRlz() { |
| 392 GetInstance()->rlz_cache_.clear(); | 393 GetInstance()->rlz_cache_.clear(); |
| 393 GetInstance()->registrar_.RemoveAll(); | 394 GetInstance()->registrar_.RemoveAll(); |
| 394 } | 395 } |
| OLD | NEW |