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

Side by Side 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 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/android/provider/chrome_browser_provider.h" 5 #include "chrome/browser/android/provider/chrome_browser_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <list> 8 #include <list>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 favicon_service_ = FaviconServiceFactory::GetForProfile( 1169 favicon_service_ = FaviconServiceFactory::GetForProfile(
1170 profile_, Profile::EXPLICIT_ACCESS), 1170 profile_, Profile::EXPLICIT_ACCESS),
1171 service_.reset(new AndroidHistoryProviderService(profile_)); 1171 service_.reset(new AndroidHistoryProviderService(profile_));
1172 1172
1173 // Registers the notifications we are interested. 1173 // Registers the notifications we are interested.
1174 bookmark_model_->AddObserver(this); 1174 bookmark_model_->AddObserver(this);
1175 history_service_observer_.Add( 1175 history_service_observer_.Add(
1176 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)); 1176 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS));
1177 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, 1177 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
1178 content::NotificationService::AllSources()); 1178 content::NotificationService::AllSources());
1179 notification_registrar_.Add(this,
1180 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED,
1181 content::NotificationService::AllSources());
1182 TemplateURLService* template_service = 1179 TemplateURLService* template_service =
1183 TemplateURLServiceFactory::GetForProfile(profile_); 1180 TemplateURLServiceFactory::GetForProfile(profile_);
1184 if (!template_service->loaded()) 1181 if (!template_service->loaded())
1185 template_service->Load(); 1182 template_service->Load();
1186 } 1183 }
1187 1184
1188 ChromeBrowserProvider::~ChromeBrowserProvider() { 1185 ChromeBrowserProvider::~ChromeBrowserProvider() {
1189 bookmark_model_->RemoveObserver(this); 1186 bookmark_model_->RemoveObserver(this);
1190 } 1187 }
1191 1188
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 } 1616 }
1620 1617
1621 void ChromeBrowserProvider::OnURLVisited(HistoryService* history_service, 1618 void ChromeBrowserProvider::OnURLVisited(HistoryService* history_service,
1622 ui::PageTransition transition, 1619 ui::PageTransition transition,
1623 const history::URLRow& row, 1620 const history::URLRow& row,
1624 const history::RedirectList& redirects, 1621 const history::RedirectList& redirects,
1625 base::Time visit_time) { 1622 base::Time visit_time) {
1626 OnHistoryChanged(); 1623 OnHistoryChanged();
1627 } 1624 }
1628 1625
1626 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.
1627 JNIEnv* env = AttachCurrentThread();
1628 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1629 if (obj.is_null())
1630 return;
1631 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1632 }
1633
1634 void ChromeBrowserProvider::OnKeywordSearchTermUpdated(
1635 HistoryService* history_service,
1636 const history::URLRow& row,
1637 history::KeywordID keyword_id,
1638 const base::string16& term) {
1639 OnSearchTermUpdated();
1640 }
1641
1629 void ChromeBrowserProvider::Observe( 1642 void ChromeBrowserProvider::Observe(
1630 int type, 1643 int type,
1631 const content::NotificationSource& source, 1644 const content::NotificationSource& source,
1632 const content::NotificationDetails& details) { 1645 const content::NotificationDetails& details) {
1633 if (type == chrome::NOTIFICATION_HISTORY_URLS_DELETED) { 1646 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED);
1634 OnHistoryChanged(); 1647 OnHistoryChanged();
1635 } else if (type ==
1636 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) {
1637 JNIEnv* env = AttachCurrentThread();
1638 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env);
1639 if (obj.is_null())
1640 return;
1641 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj());
1642 }
1643 } 1648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698