| OLD | NEW |
| 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.h" | 5 #include "chrome/browser/webdata/web_data_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 7 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 8 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
| 9 #include "chrome/browser/webdata/keyword_table.h" | 10 #include "chrome/browser/webdata/keyword_table.h" |
| 10 #include "chrome/browser/webdata/logins_table.h" | 11 #include "chrome/browser/webdata/logins_table.h" |
| 11 #include "chrome/browser/webdata/token_service_table.h" | 12 #include "chrome/browser/webdata/token_service_table.h" |
| 12 #include "chrome/browser/webdata/web_apps_table.h" | 13 #include "chrome/browser/webdata/web_apps_table.h" |
| 13 #include "chrome/browser/webdata/web_intents_table.h" | 14 #include "chrome/browser/webdata/web_intents_table.h" |
| 14 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
| 15 #include "components/webdata/common/web_database_service.h" | 16 #include "components/webdata/common/web_database_service.h" |
| 17 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
| 17 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 19 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 20 | 22 |
| 21 //////////////////////////////////////////////////////////////////////////////// | 23 //////////////////////////////////////////////////////////////////////////////// |
| 22 // | 24 // |
| 23 // WebDataService implementation. | 25 // WebDataService implementation. |
| 24 // | 26 // |
| 25 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
| 26 | 28 |
| 27 using base::Bind; | 29 using base::Bind; |
| 28 using base::Time; | 30 using base::Time; |
| 29 using content::BrowserThread; | 31 using content::BrowserThread; |
| 30 | 32 |
| 31 WDAppImagesResult::WDAppImagesResult() : has_all_images(false) {} | 33 WDAppImagesResult::WDAppImagesResult() : has_all_images(false) {} |
| 32 | 34 |
| 33 WDAppImagesResult::~WDAppImagesResult() {} | 35 WDAppImagesResult::~WDAppImagesResult() {} |
| 34 | 36 |
| 35 WDKeywordsResult::WDKeywordsResult() | 37 WDKeywordsResult::WDKeywordsResult() |
| 36 : default_search_provider_id(0), | 38 : default_search_provider_id(0), |
| 37 builtin_keyword_version(0) { | 39 builtin_keyword_version(0) { |
| 38 } | 40 } |
| 39 | 41 |
| 40 WDKeywordsResult::~WDKeywordsResult() {} | 42 WDKeywordsResult::~WDKeywordsResult() {} |
| 41 | 43 |
| 42 WebDataService::WebDataService(scoped_refptr<WebDatabaseService> wdbs, | 44 WebDataService::WebDataService(scoped_refptr<WebDatabaseService> wdbs, |
| 43 const ProfileErrorCallback& callback) | 45 const ProfileErrorCallback& callback) |
| 44 : WebDataServiceBase(wdbs, callback) { | 46 : WebDataServiceBase(wdbs, callback, |
| 47 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { |
| 45 } | 48 } |
| 46 | 49 |
| 47 ////////////////////////////////////////////////////////////////////////////// | 50 ////////////////////////////////////////////////////////////////////////////// |
| 48 // | 51 // |
| 49 // Keywords. | 52 // Keywords. |
| 50 // | 53 // |
| 51 ////////////////////////////////////////////////////////////////////////////// | 54 ////////////////////////////////////////////////////////////////////////////// |
| 52 | 55 |
| 53 void WebDataService::AddKeyword(const TemplateURLData& data) { | 56 void WebDataService::AddKeyword(const TemplateURLData& data) { |
| 54 wdbs_->ScheduleDBTask( | 57 wdbs_->ScheduleDBTask( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 111 |
| 109 WebDataServiceBase::Handle WebDataService::GetWebAppImages( | 112 WebDataServiceBase::Handle WebDataService::GetWebAppImages( |
| 110 const GURL& app_url, WebDataServiceConsumer* consumer) { | 113 const GURL& app_url, WebDataServiceConsumer* consumer) { |
| 111 return wdbs_->ScheduleDBTaskWithResult(FROM_HERE, | 114 return wdbs_->ScheduleDBTaskWithResult(FROM_HERE, |
| 112 Bind(&WebDataService::GetWebAppImagesImpl, this, app_url), consumer); | 115 Bind(&WebDataService::GetWebAppImagesImpl, this, app_url), consumer); |
| 113 } | 116 } |
| 114 | 117 |
| 115 //////////////////////////////////////////////////////////////////////////////// | 118 //////////////////////////////////////////////////////////////////////////////// |
| 116 | 119 |
| 117 WebDataService::WebDataService() | 120 WebDataService::WebDataService() |
| 118 : WebDataServiceBase(NULL, ProfileErrorCallback()) { | 121 : WebDataServiceBase(NULL, ProfileErrorCallback(), |
| 122 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { |
| 119 } | 123 } |
| 120 | 124 |
| 121 WebDataService::~WebDataService() { | 125 WebDataService::~WebDataService() { |
| 122 } | 126 } |
| 123 | 127 |
| 124 //////////////////////////////////////////////////////////////////////////////// | 128 //////////////////////////////////////////////////////////////////////////////// |
| 125 // | 129 // |
| 126 // Keywords implementation. | 130 // Keywords implementation. |
| 127 // | 131 // |
| 128 //////////////////////////////////////////////////////////////////////////////// | 132 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 209 |
| 206 scoped_ptr<WDTypedResult> WebDataService::GetWebAppImagesImpl( | 210 scoped_ptr<WDTypedResult> WebDataService::GetWebAppImagesImpl( |
| 207 const GURL& app_url, WebDatabase* db) { | 211 const GURL& app_url, WebDatabase* db) { |
| 208 WDAppImagesResult result; | 212 WDAppImagesResult result; |
| 209 result.has_all_images = | 213 result.has_all_images = |
| 210 WebAppsTable::FromWebDatabase(db)->GetWebAppHasAllImages(app_url); | 214 WebAppsTable::FromWebDatabase(db)->GetWebAppHasAllImages(app_url); |
| 211 WebAppsTable::FromWebDatabase(db)->GetWebAppImages(app_url, &result.images); | 215 WebAppsTable::FromWebDatabase(db)->GetWebAppImages(app_url, &result.images); |
| 212 return scoped_ptr<WDTypedResult>( | 216 return scoped_ptr<WDTypedResult>( |
| 213 new WDResult<WDAppImagesResult>(WEB_APP_IMAGES, result)); | 217 new WDResult<WDAppImagesResult>(WEB_APP_IMAGES, result)); |
| 214 } | 218 } |
| OLD | NEW |