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

Side by Side Diff: chrome/browser/webdata/web_data_service_factory.cc

Issue 12853004: Move creation of WebDatabaseTable subclasses to WebDatabaseServiceFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to parent and head. Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webdata/web_data_service_factory.h" 5 #include "chrome/browser/webdata/web_data_service_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "chrome/browser/profiles/profile_dependency_manager.h" 9 #include "chrome/browser/profiles/profile_dependency_manager.h"
10 #include "chrome/browser/ui/profile_error_dialog.h" 10 #include "chrome/browser/ui/profile_error_dialog.h"
11 #include "chrome/browser/webdata/autocomplete_syncable_service.h" 11 #include "chrome/browser/webdata/autocomplete_syncable_service.h"
12 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" 12 #include "chrome/browser/webdata/autofill_profile_syncable_service.h"
13 #include "chrome/browser/webdata/autofill_table.h"
13 #include "chrome/browser/webdata/autofill_web_data_service_impl.h" 14 #include "chrome/browser/webdata/autofill_web_data_service_impl.h"
15 #include "chrome/browser/webdata/keyword_table.h"
16 #include "chrome/browser/webdata/logins_table.h"
17 #include "chrome/browser/webdata/token_service_table.h"
18 #include "chrome/browser/webdata/web_apps_table.h"
19 #include "chrome/browser/webdata/web_intents_table.h"
14 #include "chrome/common/chrome_constants.h" 20 #include "chrome/common/chrome_constants.h"
15 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
16 #include "grit/chromium_strings.h" 22 #include "grit/chromium_strings.h"
17 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
18 24
19 using content::BrowserThread; 25 using content::BrowserThread;
20 26
21 namespace { 27 namespace {
22 28
23 // Callback to show error dialog on profile load error. 29 // Callback to show error dialog on profile load error.
(...skipping 13 matching lines...) Expand all
37 } 43 }
38 44
39 } // namespace 45 } // namespace
40 46
41 WebDataServiceWrapper::WebDataServiceWrapper() {} 47 WebDataServiceWrapper::WebDataServiceWrapper() {}
42 48
43 WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile) { 49 WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile) {
44 base::FilePath path = profile->GetPath(); 50 base::FilePath path = profile->GetPath();
45 path = path.Append(chrome::kWebDataFilename); 51 path = path.Append(chrome::kWebDataFilename);
46 web_data_service_ = new WebDataService(base::Bind(&ProfileErrorCallback)); 52 web_data_service_ = new WebDataService(base::Bind(&ProfileErrorCallback));
53
54 // All tables objects that participate in managing the database must
55 // be added here.
56 web_data_service_->AddTable(
57 scoped_ptr<WebDatabaseTable>(new AutofillTable()));
58 web_data_service_->AddTable(
59 scoped_ptr<WebDatabaseTable>(new KeywordTable()));
60 // TODO(mdm): We only really need the LoginsTable on Windows for IE7 password
61 // access, but for now, we still create it on all platforms since it deletes
62 // the old logins table. We can remove this after a while, e.g. in M22 or so.
63 web_data_service_->AddTable(
64 scoped_ptr<WebDatabaseTable>(new LoginsTable()));
65 web_data_service_->AddTable(
66 scoped_ptr<WebDatabaseTable>(new TokenServiceTable()));
67 web_data_service_->AddTable(
68 scoped_ptr<WebDatabaseTable>(new WebAppsTable()));
69 // TODO(thakis): Add a migration to delete the SQL table used by
70 // WebIntentsTable, then remove this.
71 web_data_service_->AddTable(
72 scoped_ptr<WebDatabaseTable>(new WebIntentsTable()));
73
47 web_data_service_->Init(path); 74 web_data_service_->Init(path);
48 75
49 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 76 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
50 base::Bind(&InitSyncableServicesOnDBThread, 77 base::Bind(&InitSyncableServicesOnDBThread,
51 web_data_service_)); 78 web_data_service_));
52 } 79 }
53 80
54 WebDataServiceWrapper::~WebDataServiceWrapper() { 81 WebDataServiceWrapper::~WebDataServiceWrapper() {
55 } 82 }
56 83
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 168 }
142 169
143 ProfileKeyedService* 170 ProfileKeyedService*
144 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const { 171 WebDataServiceFactory::BuildServiceInstanceFor(Profile* profile) const {
145 return new WebDataServiceWrapper(profile); 172 return new WebDataServiceWrapper(profile);
146 } 173 }
147 174
148 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { 175 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const {
149 return true; 176 return true;
150 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698