| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/history/in_memory_history_backend.h" | 5 #include "chrome/browser/history/in_memory_history_backend.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/history/history_notifications.h" | 8 #include "chrome/browser/history/history_notifications.h" |
| 9 #include "chrome/browser/history/in_memory_database.h" | 9 #include "chrome/browser/history/in_memory_database.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // a browser process, at which point this check can then be nuked. | 55 // a browser process, at which point this check can then be nuked. |
| 56 if (!g_browser_process) | 56 if (!g_browser_process) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 // Register for the notifications we care about. | 59 // Register for the notifications we care about. |
| 60 // TODO(tc): Make a ScopedNotificationObserver so we don't have to remember | 60 // TODO(tc): Make a ScopedNotificationObserver so we don't have to remember |
| 61 // to remove these manually. | 61 // to remove these manually. |
| 62 registered_for_notifications_ = true; | 62 registered_for_notifications_ = true; |
| 63 NotificationService* service = NotificationService::current(); | 63 NotificationService* service = NotificationService::current(); |
| 64 service->AddObserver(this, NotificationType::HISTORY_URL_VISITED, source); | 64 service->AddObserver(this, NotificationType::HISTORY_URL_VISITED, source); |
| 65 service->AddObserver(this, NotificationType::HISTORY_TYPED_URLS_MODIFIED, sour
ce); | 65 service->AddObserver(this, |
| 66 NotificationType::HISTORY_TYPED_URLS_MODIFIED, |
| 67 source); |
| 66 service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED, source); | 68 service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED, source); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void InMemoryHistoryBackend::Observe(NotificationType type, | 71 void InMemoryHistoryBackend::Observe(NotificationType type, |
| 70 const NotificationSource& source, | 72 const NotificationSource& source, |
| 71 const NotificationDetails& details) { | 73 const NotificationDetails& details) { |
| 72 switch (type.value) { | 74 switch (type.value) { |
| 73 case NotificationType::HISTORY_URL_VISITED: { | 75 case NotificationType::HISTORY_URL_VISITED: { |
| 74 Details<history::URLVisitedDetails> visited_details(details); | 76 Details<history::URLVisitedDetails> visited_details(details); |
| 75 if (visited_details->row.typed_count() > 0) { | 77 if (visited_details->row.typed_count() > 0) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (id) { | 134 if (id) { |
| 133 // We typically won't have most of them since we only have a subset of | 135 // We typically won't have most of them since we only have a subset of |
| 134 // history, so ignore errors. | 136 // history, so ignore errors. |
| 135 db_->DeleteURLRow(id); | 137 db_->DeleteURLRow(id); |
| 136 } | 138 } |
| 137 } | 139 } |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace history | 142 } // namespace history |
| 141 | 143 |
| OLD | NEW |