| 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 #include "chrome/browser/extensions/extension_history_api.h" | 5 #include "chrome/browser/extensions/extension_history_api.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (registrar_.IsEmpty()) { | 75 if (registrar_.IsEmpty()) { |
| 76 registrar_.Add(this, | 76 registrar_.Add(this, |
| 77 NotificationType::HISTORY_URL_VISITED, | 77 NotificationType::HISTORY_URL_VISITED, |
| 78 NotificationService::AllSources()); | 78 NotificationService::AllSources()); |
| 79 registrar_.Add(this, | 79 registrar_.Add(this, |
| 80 NotificationType::HISTORY_URLS_DELETED, | 80 NotificationType::HISTORY_URLS_DELETED, |
| 81 NotificationService::AllSources()); | 81 NotificationService::AllSources()); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 ExtensionHistoryEventRouter::ExtensionHistoryEventRouter() {} |
| 86 |
| 87 ExtensionHistoryEventRouter::~ExtensionHistoryEventRouter() {} |
| 88 |
| 85 void ExtensionHistoryEventRouter::Observe(NotificationType type, | 89 void ExtensionHistoryEventRouter::Observe(NotificationType type, |
| 86 const NotificationSource& source, | 90 const NotificationSource& source, |
| 87 const NotificationDetails& details) { | 91 const NotificationDetails& details) { |
| 88 ProfileMap::iterator it = profiles_.find(source.map_key()); | 92 ProfileMap::iterator it = profiles_.find(source.map_key()); |
| 89 if (it != profiles_.end()) { | 93 if (it != profiles_.end()) { |
| 90 Profile* profile = it->second; | 94 Profile* profile = it->second; |
| 91 switch (type.value) { | 95 switch (type.value) { |
| 92 case NotificationType::HISTORY_URL_VISITED: | 96 case NotificationType::HISTORY_URL_VISITED: |
| 93 HistoryUrlVisited( | 97 HistoryUrlVisited( |
| 94 profile, | 98 profile, |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 base::Time::Now(), // To the current time. | 379 base::Time::Now(), // To the current time. |
| 376 &cancelable_consumer_, | 380 &cancelable_consumer_, |
| 377 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); | 381 NewCallback(this, &DeleteAllHistoryFunction::DeleteComplete)); |
| 378 | 382 |
| 379 return true; | 383 return true; |
| 380 } | 384 } |
| 381 | 385 |
| 382 void DeleteAllHistoryFunction::DeleteComplete() { | 386 void DeleteAllHistoryFunction::DeleteComplete() { |
| 383 SendAsyncResponse(); | 387 SendAsyncResponse(); |
| 384 } | 388 } |
| OLD | NEW |