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

Side by Side Diff: chrome/browser/search/suggestions/suggestions_service_factory.cc

Issue 630073002: [Suggestions] Create ImageEncoder, to abstract away image encode/decode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pure virtual image_encoder Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/chrome_browser.gypi » ('j') | components/suggestions.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/search/suggestions/suggestions_service_factory.h" 5 #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/incognito_helpers.h" 9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search/suggestions/image_fetcher_impl.h" 11 #include "chrome/browser/search/suggestions/image_fetcher_impl.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/leveldb_proto/proto_database.h" 13 #include "components/leveldb_proto/proto_database.h"
14 #include "components/leveldb_proto/proto_database_impl.h" 14 #include "components/leveldb_proto/proto_database_impl.h"
15 #include "components/pref_registry/pref_registry_syncable.h" 15 #include "components/pref_registry/pref_registry_syncable.h"
16 #include "components/suggestions/blacklist_store.h" 16 #include "components/suggestions/blacklist_store.h"
17 #include "components/suggestions/image_encoder.h"
17 #include "components/suggestions/image_fetcher.h" 18 #include "components/suggestions/image_fetcher.h"
18 #include "components/suggestions/image_manager.h" 19 #include "components/suggestions/image_manager.h"
20 #include "components/suggestions/jpeg_image_encoder.h"
19 #include "components/suggestions/proto/suggestions.pb.h" 21 #include "components/suggestions/proto/suggestions.pb.h"
20 #include "components/suggestions/suggestions_service.h" 22 #include "components/suggestions/suggestions_service.h"
21 #include "components/suggestions/suggestions_store.h" 23 #include "components/suggestions/suggestions_store.h"
22 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
24 26
25 using content::BrowserThread; 27 using content::BrowserThread;
26 28
27 namespace suggestions { 29 namespace suggestions {
28 30
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 new SuggestionsStore(the_profile->GetPrefs())); 67 new SuggestionsStore(the_profile->GetPrefs()));
66 scoped_ptr<BlacklistStore> blacklist_store( 68 scoped_ptr<BlacklistStore> blacklist_store(
67 new BlacklistStore(the_profile->GetPrefs())); 69 new BlacklistStore(the_profile->GetPrefs()));
68 70
69 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData> > db( 71 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData> > db(
70 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner)); 72 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner));
71 73
72 base::FilePath database_dir( 74 base::FilePath database_dir(
73 the_profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); 75 the_profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails")));
74 76
77 scoped_ptr<JpegImageEncoder> image_encoder(new JpegImageEncoder());
75 scoped_ptr<ImageFetcherImpl> image_fetcher( 78 scoped_ptr<ImageFetcherImpl> image_fetcher(
76 new ImageFetcherImpl(the_profile->GetRequestContext())); 79 new ImageFetcherImpl(the_profile->GetRequestContext()));
77 scoped_ptr<ImageManager> thumbnail_manager(new ImageManager( 80 scoped_ptr<ImageManager> thumbnail_manager(new ImageManager(
78 image_fetcher.PassAs<ImageFetcher>(), 81 image_fetcher.PassAs<ImageFetcher>(),
82 image_encoder.PassAs<ImageEncoder>(),
blundell 2014/10/07 14:13:59 hmm, I think there was a chromium-dev@ thread abou
Mathieu 2014/10/07 16:00:29 Done.
79 db.PassAs<leveldb_proto::ProtoDatabase<ImageData> >(), database_dir)); 83 db.PassAs<leveldb_proto::ProtoDatabase<ImageData> >(), database_dir));
80 return new SuggestionsService( 84 return new SuggestionsService(
81 the_profile->GetRequestContext(), suggestions_store.Pass(), 85 the_profile->GetRequestContext(), suggestions_store.Pass(),
82 thumbnail_manager.Pass(), blacklist_store.Pass()); 86 thumbnail_manager.Pass(), blacklist_store.Pass());
83 } 87 }
84 88
85 void SuggestionsServiceFactory::RegisterProfilePrefs( 89 void SuggestionsServiceFactory::RegisterProfilePrefs(
86 user_prefs::PrefRegistrySyncable* registry) { 90 user_prefs::PrefRegistrySyncable* registry) {
87 SuggestionsService::RegisterProfilePrefs(registry); 91 SuggestionsService::RegisterProfilePrefs(registry);
88 } 92 }
89 93
90 } // namespace suggestions 94 } // namespace suggestions
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_browser.gypi » ('j') | components/suggestions.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698