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

Side by Side Diff: components/webdata/common/web_data_service_base.cc

Issue 16174013: Remove dependency of WebData on content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 7 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
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 "components/webdata/common/web_data_service_base.h" 5 #include "components/webdata/common/web_data_service_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "components/webdata/common/web_database_service.h" 11 #include "components/webdata/common/web_database_service.h"
12 #ifdef DEBUG
13 #include "content/public/browser/browser_thread.h"
14 #endif
15 12
16 //////////////////////////////////////////////////////////////////////////////// 13 ////////////////////////////////////////////////////////////////////////////////
17 // 14 //
18 // WebDataServiceBase implementation. 15 // WebDataServiceBase implementation.
19 // 16 //
20 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
21 18
22 using base::Bind; 19 using base::Bind;
23 using base::Time; 20 using base::Time;
24 using content::BrowserThread;
25 21
26 WebDataServiceBase::WebDataServiceBase(scoped_refptr<WebDatabaseService> wdbs, 22 WebDataServiceBase::WebDataServiceBase(
27 const ProfileErrorCallback& callback) 23 scoped_refptr<WebDatabaseService> wdbs,
28 : wdbs_(wdbs), 24 const ProfileErrorCallback& callback,
25 const scoped_refptr<base::MessageLoopProxy>& ui_thread)
26 : base::RefCountedDeleteOnMessageLoop<WebDataServiceBase>(ui_thread),
27 wdbs_(wdbs),
29 profile_error_callback_(callback) { 28 profile_error_callback_(callback) {
30 // WebDataService requires DB thread if instantiated.
31 // Set WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL)
32 // if you do not want to instantiate WebDataService in your test.
33 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB));
34 } 29 }
35 30
36 void WebDataServiceBase::ShutdownOnUIThread() { 31 void WebDataServiceBase::ShutdownOnUIThread() {
37 } 32 }
38 33
39 void WebDataServiceBase::Init() { 34 void WebDataServiceBase::Init() {
40 DCHECK(wdbs_.get()); 35 DCHECK(wdbs_.get());
41 wdbs_->RegisterDBErrorCallback(profile_error_callback_); 36 wdbs_->RegisterDBErrorCallback(profile_error_callback_);
42 wdbs_->LoadDatabase(); 37 wdbs_->LoadDatabase();
43 } 38 }
(...skipping 30 matching lines...) Expand all
74 } 69 }
75 70
76 WebDatabase* WebDataServiceBase::GetDatabase() { 71 WebDatabase* WebDataServiceBase::GetDatabase() {
77 if (!wdbs_.get()) 72 if (!wdbs_.get())
78 return NULL; 73 return NULL;
79 return wdbs_->GetDatabaseOnDB(); 74 return wdbs_->GetDatabaseOnDB();
80 } 75 }
81 76
82 WebDataServiceBase::~WebDataServiceBase() { 77 WebDataServiceBase::~WebDataServiceBase() {
83 } 78 }
OLDNEW
« no previous file with comments | « components/webdata/common/web_data_service_base.h ('k') | components/webdata/common/web_data_service_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698