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

Side by Side Diff: chrome/browser/history/chrome_history_client_factory.cc

Issue 441623002: Eliminate sending NOTIFICATION_TOP_SITES_* from TopSites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/history/chrome_history_client_factory.h" 5 #include "chrome/browser/history/chrome_history_client_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/history/chrome_history_client.h" 9 #include "chrome/browser/history/chrome_history_client.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 13
14 namespace history {
sdefresne 2014/08/04 08:47:18 Remove, this is un-necessary.
nshaik 2014/08/05 06:38:03 Done.
15 class TopSites;
16 }
17
14 // static 18 // static
15 ChromeHistoryClient* ChromeHistoryClientFactory::GetForProfile( 19 ChromeHistoryClient* ChromeHistoryClientFactory::GetForProfile(
16 Profile* profile) { 20 Profile* profile) {
17 return static_cast<ChromeHistoryClient*>( 21 return static_cast<ChromeHistoryClient*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true)); 22 GetInstance()->GetServiceForBrowserContext(profile, true));
19 } 23 }
20 24
21 // static 25 // static
22 ChromeHistoryClientFactory* ChromeHistoryClientFactory::GetInstance() { 26 ChromeHistoryClientFactory* ChromeHistoryClientFactory::GetInstance() {
23 return Singleton<ChromeHistoryClientFactory>::get(); 27 return Singleton<ChromeHistoryClientFactory>::get();
24 } 28 }
25 29
26 ChromeHistoryClientFactory::ChromeHistoryClientFactory() 30 ChromeHistoryClientFactory::ChromeHistoryClientFactory()
27 : BrowserContextKeyedServiceFactory( 31 : BrowserContextKeyedServiceFactory(
28 "ChromeHistoryClient", 32 "ChromeHistoryClient",
29 BrowserContextDependencyManager::GetInstance()) { 33 BrowserContextDependencyManager::GetInstance()) {
30 DependsOn(BookmarkModelFactory::GetInstance()); 34 DependsOn(BookmarkModelFactory::GetInstance());
31 } 35 }
32 36
33 ChromeHistoryClientFactory::~ChromeHistoryClientFactory() { 37 ChromeHistoryClientFactory::~ChromeHistoryClientFactory() {
34 } 38 }
35 39
36 KeyedService* ChromeHistoryClientFactory::BuildServiceInstanceFor( 40 KeyedService* ChromeHistoryClientFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const { 41 content::BrowserContext* context) const {
38 return new ChromeHistoryClient( 42 return new ChromeHistoryClient(
39 BookmarkModelFactory::GetForProfile(static_cast<Profile*>(context))); 43 BookmarkModelFactory::GetForProfile(static_cast<Profile*>(context)),
44 static_cast<Profile*>(context)->GetTopSites());
40 } 45 }
41 46
42 content::BrowserContext* ChromeHistoryClientFactory::GetBrowserContextToUse( 47 content::BrowserContext* ChromeHistoryClientFactory::GetBrowserContextToUse(
43 content::BrowserContext* context) const { 48 content::BrowserContext* context) const {
44 return chrome::GetBrowserContextRedirectedInIncognito(context); 49 return chrome::GetBrowserContextRedirectedInIncognito(context);
45 } 50 }
46 51
47 bool ChromeHistoryClientFactory::ServiceIsNULLWhileTesting() const { 52 bool ChromeHistoryClientFactory::ServiceIsNULLWhileTesting() const {
48 return true; 53 return true;
49 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698