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

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

Issue 364343002: Kill WebDataService, move (WIN only) Password code into separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments and clean up Created 6 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/webdata/web_data_service.h"
6
7 #include "base/bind.h"
8 #include "chrome/browser/webdata/logins_table.h"
9 #include "chrome/browser/webdata/web_apps_table.h"
10 #include "chrome/browser/webdata/web_intents_table.h"
11 #include "components/search_engines/template_url.h"
12 #include "components/signin/core/browser/webdata/token_service_table.h"
13 #include "components/webdata/common/web_database_service.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "third_party/skia/include/core/SkBitmap.h"
16
17 ////////////////////////////////////////////////////////////////////////////////
18 //
19 // WebDataService implementation.
20 //
21 ////////////////////////////////////////////////////////////////////////////////
22
23 using base::Bind;
24 using content::BrowserThread;
25
26 WDAppImagesResult::WDAppImagesResult() : has_all_images(false) {}
27
28 WDAppImagesResult::~WDAppImagesResult() {}
29
30 WebDataService::WebDataService(scoped_refptr<WebDatabaseService> wdbs,
31 const ProfileErrorCallback& callback)
32 : WebDataServiceBase(
33 wdbs, callback,
34 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) {
35 }
36
37 //////////////////////////////////////////////////////////////////////////////
38 //
39 // Web Apps
40 //
41 //////////////////////////////////////////////////////////////////////////////
42
43 void WebDataService::SetWebAppImage(const GURL& app_url,
44 const SkBitmap& image) {
45 wdbs_->ScheduleDBTask(FROM_HERE,
46 Bind(&WebDataService::SetWebAppImageImpl, this, app_url, image));
47 }
48
49 void WebDataService::SetWebAppHasAllImages(const GURL& app_url,
50 bool has_all_images) {
51 wdbs_->ScheduleDBTask(FROM_HERE,
52 Bind(&WebDataService::SetWebAppHasAllImagesImpl, this, app_url,
53 has_all_images));
54 }
55
56 void WebDataService::RemoveWebApp(const GURL& app_url) {
57 wdbs_->ScheduleDBTask(FROM_HERE,
58 Bind(&WebDataService::RemoveWebAppImpl, this, app_url));
59 }
60
61 WebDataServiceBase::Handle WebDataService::GetWebAppImages(
62 const GURL& app_url, WebDataServiceConsumer* consumer) {
63 return wdbs_->ScheduleDBTaskWithResult(FROM_HERE,
64 Bind(&WebDataService::GetWebAppImagesImpl, this, app_url), consumer);
65 }
66
67 ////////////////////////////////////////////////////////////////////////////////
68
69 WebDataService::WebDataService()
70 : WebDataServiceBase(
71 NULL, ProfileErrorCallback(),
72 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) {
73 }
74
75 WebDataService::~WebDataService() {
76 }
77
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Web Apps implementation.
81 //
82 ////////////////////////////////////////////////////////////////////////////////
83
84 WebDatabase::State WebDataService::SetWebAppImageImpl(
85 const GURL& app_url, const SkBitmap& image, WebDatabase* db) {
86 WebAppsTable::FromWebDatabase(db)->SetWebAppImage(app_url, image);
87 return WebDatabase::COMMIT_NEEDED;
88 }
89
90 WebDatabase::State WebDataService::SetWebAppHasAllImagesImpl(
91 const GURL& app_url, bool has_all_images, WebDatabase* db) {
92 WebAppsTable::FromWebDatabase(db)->SetWebAppHasAllImages(app_url,
93 has_all_images);
94 return WebDatabase::COMMIT_NEEDED;
95 }
96
97 WebDatabase::State WebDataService::RemoveWebAppImpl(
98 const GURL& app_url, WebDatabase* db) {
99 WebAppsTable::FromWebDatabase(db)->RemoveWebApp(app_url);
100 return WebDatabase::COMMIT_NEEDED;
101 }
102
103 scoped_ptr<WDTypedResult> WebDataService::GetWebAppImagesImpl(
104 const GURL& app_url, WebDatabase* db) {
105 WDAppImagesResult result;
106 result.has_all_images =
107 WebAppsTable::FromWebDatabase(db)->GetWebAppHasAllImages(app_url);
108 WebAppsTable::FromWebDatabase(db)->GetWebAppImages(app_url, &result.images);
109 return scoped_ptr<WDTypedResult>(
110 new WDResult<WDAppImagesResult>(WEB_APP_IMAGES, result));
111 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | chrome/browser/webdata/web_data_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698