Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1399)

Unified Diff: chrome/browser/android/provider/chrome_browser_provider.cc

Issue 651193002: Remove NOTIFICATION_HISTORY_URL_VISITED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@373326.2
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ef625f143e000db783fad587a02c918af2250566..a0e59b57a9c1284b4f9b8b54a4855536dff3bb46 100644
--- a/chrome/browser/android/provider/chrome_browser_provider.cc
+++ b/chrome/browser/android/provider/chrome_browser_provider.cc
@@ -1158,6 +1158,8 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj)
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
profile_ = g_browser_process->profile_manager()->GetLastUsedProfile();
bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_);
+ history_service_ =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
top_sites_ = profile_->GetTopSites();
service_.reset(new AndroidHistoryProviderService(profile_));
favicon_service_.reset(FaviconServiceFactory::GetForProfile(profile_,
@@ -1165,8 +1167,7 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj)
// Registers the notifications we are interested.
bookmark_model_->AddObserver(this);
- notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URL_VISITED,
- content::NotificationService::AllSources());
+ history_service_->AddObserver(this);
notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
content::NotificationService::AllSources());
notification_registrar_.Add(this,
@@ -1180,6 +1181,7 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj)
ChromeBrowserProvider::~ChromeBrowserProvider() {
bookmark_model_->RemoveObserver(this);
+ history_service_->RemoveObserver(this);
}
void ChromeBrowserProvider::Destroy(JNIEnv*, jobject) {
@@ -1603,12 +1605,23 @@ void ChromeBrowserProvider::BookmarkModelChanged() {
Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj());
}
+void ChromeBrowserProvider::OnURLVisited(HistoryService* history_service,
+ ui::PageTransition transition,
+ const history::URLRow& row,
+ const history::RedirectList& redirects,
+ base::Time visit_time) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
+ if (obj.is_null())
+ return;
+ Java_ChromeBrowserProvider_onHistoryChanged(env, obj.obj());
+}
+
void ChromeBrowserProvider::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_HISTORY_URL_VISITED ||
- type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) {
+ if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) {
JNIEnv* env = AttachCurrentThread();
droger 2014/10/14 15:15:24 Is it possible to share some code with OnURLVisite
sdefresne 2014/10/14 16:02:05 Done.
ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
if (obj.is_null())

Powered by Google App Engine
This is Rietveld 408576698