| OLD | NEW |
| 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 | 1161 |
| 1162 ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) | 1162 ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) |
| 1163 : weak_java_provider_(env, obj), | 1163 : weak_java_provider_(env, obj), |
| 1164 history_service_observer_(this), | 1164 history_service_observer_(this), |
| 1165 handling_extensive_changes_(false) { | 1165 handling_extensive_changes_(false) { |
| 1166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1167 profile_ = g_browser_process->profile_manager()->GetLastUsedProfile(); | 1167 profile_ = g_browser_process->profile_manager()->GetLastUsedProfile(); |
| 1168 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); | 1168 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); |
| 1169 top_sites_ = profile_->GetTopSites(); | 1169 top_sites_ = profile_->GetTopSites(); |
| 1170 favicon_service_ = FaviconServiceFactory::GetForProfile( | 1170 favicon_service_ = FaviconServiceFactory::GetForProfile( |
| 1171 profile_, Profile::EXPLICIT_ACCESS), | 1171 profile_, ServiceAccessType::EXPLICIT_ACCESS), |
| 1172 service_.reset(new AndroidHistoryProviderService(profile_)); | 1172 service_.reset(new AndroidHistoryProviderService(profile_)); |
| 1173 | 1173 |
| 1174 // Registers the notifications we are interested. | 1174 // Registers the notifications we are interested. |
| 1175 bookmark_model_->AddObserver(this); | 1175 bookmark_model_->AddObserver(this); |
| 1176 history_service_observer_.Add( | 1176 history_service_observer_.Add(HistoryServiceFactory::GetForProfile( |
| 1177 HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS)); | 1177 profile_, ServiceAccessType::EXPLICIT_ACCESS)); |
| 1178 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 1178 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
| 1179 content::NotificationService::AllSources()); | 1179 content::NotificationService::AllSources()); |
| 1180 notification_registrar_.Add(this, | 1180 notification_registrar_.Add(this, |
| 1181 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, | 1181 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED, |
| 1182 content::NotificationService::AllSources()); | 1182 content::NotificationService::AllSources()); |
| 1183 TemplateURLService* template_service = | 1183 TemplateURLService* template_service = |
| 1184 TemplateURLServiceFactory::GetForProfile(profile_); | 1184 TemplateURLServiceFactory::GetForProfile(profile_); |
| 1185 if (!template_service->loaded()) | 1185 if (!template_service->loaded()) |
| 1186 template_service->Load(); | 1186 template_service->Load(); |
| 1187 } | 1187 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 OnHistoryChanged(); | 1635 OnHistoryChanged(); |
| 1636 } else if (type == | 1636 } else if (type == |
| 1637 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { | 1637 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { |
| 1638 JNIEnv* env = AttachCurrentThread(); | 1638 JNIEnv* env = AttachCurrentThread(); |
| 1639 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); | 1639 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); |
| 1640 if (obj.is_null()) | 1640 if (obj.is_null()) |
| 1641 return; | 1641 return; |
| 1642 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); | 1642 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); |
| 1643 } | 1643 } |
| 1644 } | 1644 } |
| OLD | NEW |