Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
| 26 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 26 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 27 #include "components/signin/core/browser/signin_manager.h" | 27 #include "components/signin/core/browser/signin_manager.h" |
| 28 #include "components/suggestions/blacklist_store.h" | 28 #include "components/suggestions/blacklist_store.h" |
| 29 #include "components/suggestions/image_manager.h" | 29 #include "components/suggestions/image_manager.h" |
| 30 #include "components/suggestions/proto/suggestions.pb.h" | 30 #include "components/suggestions/proto/suggestions.pb.h" |
| 31 #include "components/suggestions/suggestions_service_impl.h" | 31 #include "components/suggestions/suggestions_service_impl.h" |
| 32 #include "components/suggestions/suggestions_store.h" | 32 #include "components/suggestions/suggestions_store.h" |
| 33 #include "content/public/browser/browser_context.h" | 33 #include "content/public/browser/browser_context.h" |
| 34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 35 #include "net/traffic_annotation/network_traffic_annotation.h" | |
| 35 | 36 |
| 36 using content::BrowserThread; | 37 using content::BrowserThread; |
| 37 using image_fetcher::ImageFetcherImpl; | 38 using image_fetcher::ImageFetcherImpl; |
| 38 | 39 |
| 39 namespace suggestions { | 40 namespace suggestions { |
| 40 | 41 |
| 41 // static | 42 // static |
| 42 SuggestionsService* SuggestionsServiceFactory::GetForProfile(Profile* profile) { | 43 SuggestionsService* SuggestionsServiceFactory::GetForProfile(Profile* profile) { |
| 43 return static_cast<SuggestionsService*>( | 44 return static_cast<SuggestionsService*>( |
| 44 GetInstance()->GetServiceForBrowserContext(profile, true)); | 45 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 new SuggestionsStore(profile->GetPrefs())); | 80 new SuggestionsStore(profile->GetPrefs())); |
| 80 std::unique_ptr<BlacklistStore> blacklist_store( | 81 std::unique_ptr<BlacklistStore> blacklist_store( |
| 81 new BlacklistStore(profile->GetPrefs())); | 82 new BlacklistStore(profile->GetPrefs())); |
| 82 | 83 |
| 83 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData>> db( | 84 std::unique_ptr<leveldb_proto::ProtoDatabaseImpl<ImageData>> db( |
| 84 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner)); | 85 new leveldb_proto::ProtoDatabaseImpl<ImageData>(background_task_runner)); |
| 85 | 86 |
| 86 base::FilePath database_dir( | 87 base::FilePath database_dir( |
| 87 profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); | 88 profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); |
| 88 | 89 |
| 90 net::NetworkTrafficAnnotationTag traffic_annotation = | |
|
Marc Treib
2017/05/09 09:43:47
image_manager_traffic_annotation (otherwise it's e
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 91 net::DefineNetworkTrafficAnnotation("...", R"( | |
|
Marc Treib
2017/05/09 09:43:46
suggestions_service
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 92 semantics { | |
| 93 sender: "..." | |
|
Marc Treib
2017/05/09 09:43:46
SuggestionsService
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 94 description: "..." | |
|
Marc Treib
2017/05/09 09:43:46
Retrieves thumbnails for site suggestions based on
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 95 trigger: "..." | |
|
Marc Treib
2017/05/09 09:43:46
Triggered when a thumbnail for a suggestion is req
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 96 data: "..." | |
|
Marc Treib
2017/05/09 09:43:46
None.
Ramin Halavati
2017/05/09 11:08:24
Shouldn't it sent links to required thumbnails? An
| |
| 97 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL | |
|
Marc Treib
2017/05/09 09:43:46
GOOGLE_OWNED_SERVICE
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
| 98 } | |
| 99 policy { | |
| 100 cookies_allowed: false/true | |
|
Marc Treib
2017/05/09 09:43:46
false
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 101 cookies_store: "..." | |
| 102 setting: "..." | |
|
Marc Treib
2017/05/09 09:43:46
This cannot be disabled individually, but users ca
Ramin Halavati
2017/05/09 11:08:24
Done.
| |
| 103 chrome_policy { | |
| 104 [POLICY_NAME] { | |
| 105 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
| 106 [POLICY_NAME]: ... //(value to disable it) | |
| 107 } | |
| 108 } | |
| 109 policy_exception_justification: "..." | |
| 110 })"); | |
| 89 std::unique_ptr<ImageFetcherImpl> image_fetcher( | 111 std::unique_ptr<ImageFetcherImpl> image_fetcher( |
| 90 new ImageFetcherImpl( | 112 new ImageFetcherImpl(base::MakeUnique<suggestions::ImageDecoderImpl>(), |
| 91 base::MakeUnique<suggestions::ImageDecoderImpl>(), | 113 profile->GetRequestContext(), traffic_annotation)); |
| 92 profile->GetRequestContext())); | |
| 93 std::unique_ptr<ImageManager> thumbnail_manager(new ImageManager( | 114 std::unique_ptr<ImageManager> thumbnail_manager(new ImageManager( |
| 94 std::move(image_fetcher), std::move(db), database_dir, | 115 std::move(image_fetcher), std::move(db), database_dir, |
| 95 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB))); | 116 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB))); |
| 96 return new SuggestionsServiceImpl( | 117 return new SuggestionsServiceImpl( |
| 97 signin_manager, token_service, sync_service, profile->GetRequestContext(), | 118 signin_manager, token_service, sync_service, profile->GetRequestContext(), |
| 98 std::move(suggestions_store), std::move(thumbnail_manager), | 119 std::move(suggestions_store), std::move(thumbnail_manager), |
| 99 std::move(blacklist_store)); | 120 std::move(blacklist_store)); |
| 100 } | 121 } |
| 101 | 122 |
| 102 void SuggestionsServiceFactory::RegisterProfilePrefs( | 123 void SuggestionsServiceFactory::RegisterProfilePrefs( |
| 103 user_prefs::PrefRegistrySyncable* registry) { | 124 user_prefs::PrefRegistrySyncable* registry) { |
| 104 SuggestionsServiceImpl::RegisterProfilePrefs(registry); | 125 SuggestionsServiceImpl::RegisterProfilePrefs(registry); |
| 105 } | 126 } |
| 106 | 127 |
| 107 } // namespace suggestions | 128 } // namespace suggestions |
| OLD | NEW |