Index: chrome/browser/android/provider/chrome_browser_provider.cc |
diff --git a/chrome/browser/android/provider/chrome_browser_provider.cc b/chrome/browser/android/provider/chrome_browser_provider.cc |
index a62de40182c8bfe7eb3e2e40a937cd158f0f7e72..876be56c8b72ff86af7a23e73ede1aca68a5324c 100644 |
--- a/chrome/browser/android/provider/chrome_browser_provider.cc |
+++ b/chrome/browser/android/provider/chrome_browser_provider.cc |
@@ -27,6 +27,7 @@ |
#include "chrome/browser/favicon/favicon_service.h" |
#include "chrome/browser/favicon/favicon_service_factory.h" |
#include "chrome/browser/history/android/sqlite_cursor.h" |
+#include "chrome/browser/history/history_service.h" |
#include "chrome/browser/history/history_service_factory.h" |
#include "chrome/browser/history/top_sites.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -1172,8 +1173,6 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) |
bookmark_model_->AddObserver(this); |
history_service_observer_.Add( |
HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)); |
- notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
- content::NotificationService::AllSources()); |
notification_registrar_.Add(this, |
chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, |
content::NotificationService::AllSources()); |
@@ -1188,6 +1187,7 @@ ChromeBrowserProvider::~ChromeBrowserProvider() { |
} |
void ChromeBrowserProvider::Destroy(JNIEnv*, jobject) { |
+ history_service_observer_.RemoveAll(); |
delete this; |
} |
@@ -1623,18 +1623,22 @@ void ChromeBrowserProvider::OnURLVisited(HistoryService* history_service, |
OnHistoryChanged(); |
} |
+void ChromeBrowserProvider::OnURLsDeleted(HistoryService* history_service, |
+ bool all_history, |
+ bool expired, |
+ const history::URLRows& deleted_rows, |
+ const std::set<GURL>& favicon_urls) { |
+ OnHistoryChanged(); |
+} |
+ |
void ChromeBrowserProvider::Observe( |
int type, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) { |
- if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { |
- OnHistoryChanged(); |
- } else if (type == |
- chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { |
+ DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED); |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); |
if (obj.is_null()) |
return; |
Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); |
- } |
} |