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

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

Issue 808123003: Eliminate sending NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inline code for same function name. Created 6 years 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 681aa8bd05c02bbd3a3677518cd6d83da88f4a65..20a4cf9b927b2384dce13782db0fd524ecdf7525 100644
--- a/chrome/browser/android/provider/chrome_browser_provider.cc
+++ b/chrome/browser/android/provider/chrome_browser_provider.cc
@@ -1176,9 +1176,6 @@ ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj)
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());
TemplateURLService* template_service =
TemplateURLServiceFactory::GetForProfile(profile_);
if (!template_service->loaded())
@@ -1626,18 +1623,26 @@ void ChromeBrowserProvider::OnURLVisited(HistoryService* history_service,
OnHistoryChanged();
}
+void ChromeBrowserProvider::OnSearchTermUpdated() {
newt (away) 2014/12/30 16:00:56 I'd inline this method into OnKeywordSearchTermUpd
Abhishek 2014/12/30 16:20:52 Done.
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
+ if (obj.is_null())
+ return;
+ Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
+}
+
+void ChromeBrowserProvider::OnKeywordSearchTermUpdated(
+ HistoryService* history_service,
+ const history::URLRow& row,
+ history::KeywordID keyword_id,
+ const base::string16& term) {
+ OnSearchTermUpdated();
+}
+
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) {
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
- if (obj.is_null())
- return;
- Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
- }
+ DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED);
+ OnHistoryChanged();
}

Powered by Google App Engine
This is Rietveld 408576698