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 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 23 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
24 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 24 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/favicon/favicon_service.h" | 27 #include "chrome/browser/favicon/favicon_service.h" |
28 #include "chrome/browser/favicon/favicon_service_factory.h" | 28 #include "chrome/browser/favicon/favicon_service_factory.h" |
29 #include "chrome/browser/history/android/sqlite_cursor.h" | 29 #include "chrome/browser/history/android/sqlite_cursor.h" |
30 #include "chrome/browser/history/history_service.h" | 30 #include "chrome/browser/history/history_service.h" |
31 #include "chrome/browser/history/history_service_factory.h" | 31 #include "chrome/browser/history/history_service_factory.h" |
32 #include "chrome/browser/history/top_sites.h" | 32 #include "chrome/browser/history/top_sites.h" |
| 33 #include "chrome/browser/history/top_sites_factory.h" |
33 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
34 #include "chrome/browser/profiles/profile_manager.h" | 35 #include "chrome/browser/profiles/profile_manager.h" |
35 #include "chrome/browser/search_engines/template_url_service_factory.h" | 36 #include "chrome/browser/search_engines/template_url_service_factory.h" |
36 #include "components/bookmarks/browser/bookmark_model.h" | 37 #include "components/bookmarks/browser/bookmark_model.h" |
37 #include "components/bookmarks/browser/bookmark_utils.h" | 38 #include "components/bookmarks/browser/bookmark_utils.h" |
38 #include "components/history/core/browser/android/android_history_types.h" | 39 #include "components/history/core/browser/android/android_history_types.h" |
39 #include "components/search_engines/template_url.h" | 40 #include "components/search_engines/template_url.h" |
40 #include "components/search_engines/template_url_service.h" | 41 #include "components/search_engines/template_url_service.h" |
41 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
42 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 return RegisterNativesImpl(env); | 1161 return RegisterNativesImpl(env); |
1161 } | 1162 } |
1162 | 1163 |
1163 ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) | 1164 ChromeBrowserProvider::ChromeBrowserProvider(JNIEnv* env, jobject obj) |
1164 : weak_java_provider_(env, obj), | 1165 : weak_java_provider_(env, obj), |
1165 history_service_observer_(this), | 1166 history_service_observer_(this), |
1166 handling_extensive_changes_(false) { | 1167 handling_extensive_changes_(false) { |
1167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1168 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1168 profile_ = g_browser_process->profile_manager()->GetLastUsedProfile(); | 1169 profile_ = g_browser_process->profile_manager()->GetLastUsedProfile(); |
1169 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); | 1170 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile_); |
1170 top_sites_ = profile_->GetTopSites(); | 1171 top_sites_ = TopSitesFactory::GetForProfile(profile_); |
1171 favicon_service_ = FaviconServiceFactory::GetForProfile( | 1172 favicon_service_ = FaviconServiceFactory::GetForProfile( |
1172 profile_, ServiceAccessType::EXPLICIT_ACCESS), | 1173 profile_, ServiceAccessType::EXPLICIT_ACCESS), |
1173 service_.reset(new AndroidHistoryProviderService(profile_)); | 1174 service_.reset(new AndroidHistoryProviderService(profile_)); |
1174 | 1175 |
1175 // Registers the notifications we are interested. | 1176 // Registers the notifications we are interested. |
1176 bookmark_model_->AddObserver(this); | 1177 bookmark_model_->AddObserver(this); |
1177 history_service_observer_.Add(HistoryServiceFactory::GetForProfile( | 1178 history_service_observer_.Add(HistoryServiceFactory::GetForProfile( |
1178 profile_, ServiceAccessType::EXPLICIT_ACCESS)); | 1179 profile_, ServiceAccessType::EXPLICIT_ACCESS)); |
1179 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 1180 notification_registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
1180 content::NotificationService::AllSources()); | 1181 content::NotificationService::AllSources()); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 HistoryService* history_service, | 1642 HistoryService* history_service, |
1642 history::URLID url_id) {} | 1643 history::URLID url_id) {} |
1643 | 1644 |
1644 void ChromeBrowserProvider::Observe( | 1645 void ChromeBrowserProvider::Observe( |
1645 int type, | 1646 int type, |
1646 const content::NotificationSource& source, | 1647 const content::NotificationSource& source, |
1647 const content::NotificationDetails& details) { | 1648 const content::NotificationDetails& details) { |
1648 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED); | 1649 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED); |
1649 OnHistoryChanged(); | 1650 OnHistoryChanged(); |
1650 } | 1651 } |
OLD | NEW |