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

Side by Side Diff: chrome/browser/android/offline_pages/test_offline_page_model_builder.cc

Issue 2889663004: [DO NOT COMMIT][Offline Pages] Moving Offline Page Cache to cache directory.
Patch Set: again? Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/offline_pages/test_offline_page_model_builder.h " 5 #include "chrome/browser/android/offline_pages/test_offline_page_model_builder.h "
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h"
10 #include "base/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
11 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/common/chrome_constants.h" 13 #include "chrome/common/chrome_constants.h"
14 #include "components/offline_pages/core/archive_manager.h"
13 #include "components/offline_pages/core/offline_page_model_impl.h" 15 #include "components/offline_pages/core/offline_page_model_impl.h"
14 #include "components/offline_pages/core/offline_page_test_store.h" 16 #include "components/offline_pages/core/offline_page_test_store.h"
15 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
16 18
17 namespace offline_pages { 19 namespace offline_pages {
18 20
21 using LifetimeType = LifetimePolicy::LifetimeType;
22
19 std::unique_ptr<KeyedService> BuildTestOfflinePageModel( 23 std::unique_ptr<KeyedService> BuildTestOfflinePageModel(
20 content::BrowserContext* context) { 24 content::BrowserContext* context) {
21 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 25 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
22 base::ThreadTaskRunnerHandle::Get(); 26 base::ThreadTaskRunnerHandle::Get();
23 27
24 std::unique_ptr<OfflinePageTestStore> metadata_store( 28 std::unique_ptr<OfflinePageTestStore> metadata_store(
25 new OfflinePageTestStore(task_runner)); 29 new OfflinePageTestStore(task_runner));
26 30
27 base::FilePath archives_dir = 31 base::FilePath persistent_archives_dir =
28 context->GetPath().Append(chrome::kOfflinePageArchivesDirname); 32 context->GetPath().Append(chrome::kOfflinePageArchivesDirname);
33 base::FilePath temporary_archives_dir;
34 PathService::Get(base::DIR_CACHE, &temporary_archives_dir);
35 temporary_archives_dir =
36 temporary_archives_dir.Append(chrome::kOfflinePageArchivesDirname);
37
38 ArchiveDirectories archive_directories;
39 archive_directories.emplace(
40 std::make_pair(LifetimeType::TEMPORARY, temporary_archives_dir));
41 archive_directories.emplace(
42 std::make_pair(LifetimeType::PERSISTENT, persistent_archives_dir));
29 43
30 return std::unique_ptr<KeyedService>(new OfflinePageModelImpl( 44 return std::unique_ptr<KeyedService>(new OfflinePageModelImpl(
31 std::move(metadata_store), archives_dir, task_runner)); 45 std::move(metadata_store), archive_directories, task_runner));
32 } 46 }
33 47
34 } // namespace offline_pages 48 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_model_factory.cc ('k') | components/offline_pages/core/archive_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698