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

Side by Side Diff: chrome/browser/download/download_service_factory.cc

Issue 2895953004: Add initial Controller to DownloadService (Closed)
Patch Set: Rebased Created 3 years, 6 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 | components/download/internal/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/download/download_service_factory.h" 5 #include "chrome/browser/download/download_service_factory.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
9 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
10 #include "base/task_scheduler/post_task.h" 11 #include "base/task_scheduler/post_task.h"
11 #include "base/task_scheduler/task_traits.h" 12 #include "base/task_scheduler/task_traits.h"
12 #include "chrome/browser/profiles/incognito_helpers.h" 13 #include "chrome/browser/profiles/incognito_helpers.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "components/download/public/clients.h"
15 #include "components/download/public/download_service.h" 17 #include "components/download/public/download_service.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" 18 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
18 20
19 // static 21 // static
20 DownloadServiceFactory* DownloadServiceFactory::GetInstance() { 22 DownloadServiceFactory* DownloadServiceFactory::GetInstance() {
21 return base::Singleton<DownloadServiceFactory>::get(); 23 return base::Singleton<DownloadServiceFactory>::get();
22 } 24 }
23 25
24 // static 26 // static
(...skipping 17 matching lines...) Expand all
42 scoped_refptr<base::SequencedTaskRunner> background_task_runner = 44 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
43 base::CreateSequencedTaskRunnerWithTraits( 45 base::CreateSequencedTaskRunnerWithTraits(
44 {base::MayBlock(), base::TaskPriority::BACKGROUND}); 46 {base::MayBlock(), base::TaskPriority::BACKGROUND});
45 47
46 base::FilePath storage_dir; 48 base::FilePath storage_dir;
47 if (!profile->IsOffTheRecord() && !profile->GetPath().empty()) { 49 if (!profile->IsOffTheRecord() && !profile->GetPath().empty()) {
48 storage_dir = 50 storage_dir =
49 profile->GetPath().Append(chrome::kDownloadServiceStorageDirname); 51 profile->GetPath().Append(chrome::kDownloadServiceStorageDirname);
50 } 52 }
51 53
52 download::DownloadService* service = 54 download::DownloadService* service = download::DownloadService::Create(
53 download::DownloadService::Create(storage_dir, background_task_runner); 55 base::MakeUnique<download::DownloadClientMap>(), storage_dir,
56 background_task_runner);
54 57
55 // TODO(dtrainor): Register all clients here. 58 // TODO(dtrainor): Register all clients here.
56 return service; 59 return service;
57 } 60 }
58 61
59 content::BrowserContext* DownloadServiceFactory::GetBrowserContextToUse( 62 content::BrowserContext* DownloadServiceFactory::GetBrowserContextToUse(
60 content::BrowserContext* context) const { 63 content::BrowserContext* context) const {
61 return chrome::GetBrowserContextOwnInstanceInIncognito(context); 64 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
62 } 65 }
OLDNEW
« no previous file with comments | « no previous file | components/download/internal/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698