| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_WEBDATA_PASSWORD_WEB_DATA_SERVICE_WIN_H_ | |
| 6 #define CHROME_BROWSER_WEBDATA_PASSWORD_WEB_DATA_SERVICE_WIN_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/sequenced_task_runner_helpers.h" | |
| 12 #include "components/webdata/common/web_data_results.h" | |
| 13 #include "components/webdata/common/web_data_service_base.h" | |
| 14 #include "components/webdata/common/web_data_service_consumer.h" | |
| 15 #include "components/webdata/common/web_database.h" | |
| 16 | |
| 17 class GURL; | |
| 18 struct IE7PasswordInfo; | |
| 19 class Profile; | |
| 20 class WebDatabaseService; | |
| 21 | |
| 22 namespace base { | |
| 23 class Thread; | |
| 24 } | |
| 25 | |
| 26 namespace content { | |
| 27 class BrowserContext; | |
| 28 } | |
| 29 | |
| 30 // PasswordWebDataService is used to access IE7/8 Password data stored in the | |
| 31 // web database. All data is retrieved and archived in an asynchronous way. | |
| 32 | |
| 33 class WebDataServiceConsumer; | |
| 34 | |
| 35 class PasswordWebDataService : public WebDataServiceBase { | |
| 36 public: | |
| 37 // Retrieves a WebDataService for the given context. | |
| 38 static scoped_refptr<PasswordWebDataService> FromBrowserContext( | |
| 39 content::BrowserContext* context); | |
| 40 | |
| 41 PasswordWebDataService(scoped_refptr<WebDatabaseService> wdbs, | |
| 42 const ProfileErrorCallback& callback); | |
| 43 | |
| 44 // Adds |info| to the list of imported passwords from ie7/ie8. | |
| 45 void AddIE7Login(const IE7PasswordInfo& info); | |
| 46 | |
| 47 // Removes |info| from the list of imported passwords from ie7/ie8. | |
| 48 void RemoveIE7Login(const IE7PasswordInfo& info); | |
| 49 | |
| 50 // Gets the login matching the information in |info|. |consumer| will be | |
| 51 // notified when the request is done. The result is of type | |
| 52 // WDResult<IE7PasswordInfo>. | |
| 53 // If there is no match, the fields of the IE7PasswordInfo will be empty. | |
| 54 // All requests return a handle. The handle can be used to cancel the request. | |
| 55 Handle GetIE7Login(const IE7PasswordInfo& info, | |
| 56 WebDataServiceConsumer* consumer); | |
| 57 | |
| 58 protected: | |
| 59 // For unit tests, passes a null callback. | |
| 60 PasswordWebDataService(); | |
| 61 | |
| 62 virtual ~PasswordWebDataService(); | |
| 63 | |
| 64 private: | |
| 65 // The following methods are only invoked on the DB thread. | |
| 66 WebDatabase::State AddIE7LoginImpl(const IE7PasswordInfo& info, | |
| 67 WebDatabase* db); | |
| 68 WebDatabase::State RemoveIE7LoginImpl(const IE7PasswordInfo& info, | |
| 69 WebDatabase* db); | |
| 70 scoped_ptr<WDTypedResult> GetIE7LoginImpl(const IE7PasswordInfo& info, | |
| 71 WebDatabase* db); | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(PasswordWebDataService); | |
| 74 }; | |
| 75 | |
| 76 #endif // CHROME_BROWSER_WEBDATA_PASSWORD_WEB_DATA_SERVICE_WIN_H_ | |
| OLD | NEW |