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

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

Issue 1420003004: Wipe out offline page data on clearing cookie and site data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more feedback Created 5 years, 1 month 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/browser/browsing_data/browsing_data_remover.h » ('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 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/offline_page_model_factory.h" 5 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
11 #include "chrome/browser/profiles/incognito_helpers.h" 11 #include "chrome/browser/profiles/incognito_helpers.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" 14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15 #include "components/leveldb_proto/proto_database_impl.h"
16 #include "components/offline_pages/offline_page_metadata_store_impl.h" 15 #include "components/offline_pages/offline_page_metadata_store_impl.h"
17 #include "components/offline_pages/offline_page_model.h" 16 #include "components/offline_pages/offline_page_model.h"
18 #include "components/offline_pages/proto/offline_pages.pb.h" 17 #include "components/offline_pages/proto/offline_pages.pb.h"
19 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
20 19
21 namespace offline_pages { 20 namespace offline_pages {
22 21
23 OfflinePageModelFactory::OfflinePageModelFactory() 22 OfflinePageModelFactory::OfflinePageModelFactory()
24 : BrowserContextKeyedServiceFactory( 23 : BrowserContextKeyedServiceFactory(
25 "OfflinePageModel", 24 "OfflinePageModel",
(...skipping 10 matching lines...) Expand all
36 content::BrowserContext* context) { 35 content::BrowserContext* context) {
37 return static_cast<OfflinePageModel*>( 36 return static_cast<OfflinePageModel*>(
38 GetInstance()->GetServiceForBrowserContext(context, true)); 37 GetInstance()->GetServiceForBrowserContext(context, true));
39 } 38 }
40 39
41 KeyedService* OfflinePageModelFactory::BuildServiceInstanceFor( 40 KeyedService* OfflinePageModelFactory::BuildServiceInstanceFor(
42 content::BrowserContext* context) const { 41 content::BrowserContext* context) const {
43 scoped_refptr<base::SequencedTaskRunner> background_task_runner = 42 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
44 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 43 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
45 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); 44 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
46
47 scoped_ptr<leveldb_proto::ProtoDatabaseImpl<OfflinePageEntry>> database(
48 new leveldb_proto::ProtoDatabaseImpl<OfflinePageEntry>(
49 background_task_runner));
50
51 base::FilePath store_path; 45 base::FilePath store_path;
52 CHECK(PathService::Get(chrome::DIR_OFFLINE_PAGE_METADATA, &store_path)); 46 CHECK(PathService::Get(chrome::DIR_OFFLINE_PAGE_METADATA, &store_path));
53 scoped_ptr<OfflinePageMetadataStoreImpl> metadata_store( 47 scoped_ptr<OfflinePageMetadataStoreImpl> metadata_store(
54 new OfflinePageMetadataStoreImpl(database.Pass(), store_path)); 48 new OfflinePageMetadataStoreImpl(background_task_runner, store_path));
55 49
56 return new OfflinePageModel(metadata_store.Pass(), background_task_runner); 50 return new OfflinePageModel(metadata_store.Pass(), background_task_runner);
57 } 51 }
58 52
59 content::BrowserContext* OfflinePageModelFactory::GetBrowserContextToUse( 53 content::BrowserContext* OfflinePageModelFactory::GetBrowserContextToUse(
60 content::BrowserContext* context) const { 54 content::BrowserContext* context) const {
61 return chrome::GetBrowserContextRedirectedInIncognito(context); 55 return chrome::GetBrowserContextRedirectedInIncognito(context);
62 } 56 }
63 57
64 } // namespace offline_pages 58 } // namespace offline_pages
65 59
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698