| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_ |
| 6 #define CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "chrome/browser/webdata/web_database_table.h" | 11 #include "chrome/browser/webdata/web_database_table.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class WebDatabase; |
| 15 | 16 |
| 16 // This class manages the WebApps tables within the SQLite database passed to | 17 // This class manages the WebApps tables within the SQLite database passed to |
| 17 // the constructor. It expects the following schema: | 18 // the constructor. It expects the following schema: |
| 18 // | 19 // |
| 19 // Note: The database stores time in seconds, UTC. | 20 // Note: The database stores time in seconds, UTC. |
| 20 // | 21 // |
| 21 // web_apps | 22 // web_apps |
| 22 // url URL of the web app. | 23 // url URL of the web app. |
| 23 // has_all_images Do we have all the images? | 24 // has_all_images Do we have all the images? |
| 24 // | 25 // |
| 25 // web_app_icons | 26 // web_app_icons |
| 26 // url URL of the web app. | 27 // url URL of the web app. |
| 27 // width Width of the image. | 28 // width Width of the image. |
| 28 // height Height of the image. | 29 // height Height of the image. |
| 29 // image PNG encoded image data. | 30 // image PNG encoded image data. |
| 30 // | 31 // |
| 31 class WebAppsTable : public WebDatabaseTable { | 32 class WebAppsTable : public WebDatabaseTable { |
| 32 public: | 33 public: |
| 33 WebAppsTable(sql::Connection* db, sql::MetaTable* meta_table) | 34 WebAppsTable() {} |
| 34 : WebDatabaseTable(db, meta_table) {} | |
| 35 virtual ~WebAppsTable() {} | 35 virtual ~WebAppsTable() {} |
| 36 virtual bool Init() OVERRIDE; | 36 |
| 37 // Retrieves the WebAppsTable* owned by |database|. |
| 38 static WebAppsTable* FromWebDatabase(WebDatabase* database); |
| 39 |
| 40 virtual WebDatabaseTable::TypeKey GetTypeKey() const OVERRIDE; |
| 41 virtual bool Init(sql::Connection* db, sql::MetaTable* meta_table) OVERRIDE; |
| 37 virtual bool IsSyncable() OVERRIDE; | 42 virtual bool IsSyncable() OVERRIDE; |
| 38 virtual bool MigrateToVersion(int version, | 43 virtual bool MigrateToVersion(int version, |
| 39 const std::string& app_locale, | 44 const std::string& app_locale, |
| 40 bool* update_compatible_version) OVERRIDE; | 45 bool* update_compatible_version) OVERRIDE; |
| 41 | 46 |
| 42 bool SetWebAppImage(const GURL& url, const SkBitmap& image); | 47 bool SetWebAppImage(const GURL& url, const SkBitmap& image); |
| 43 | 48 |
| 44 // Returns true if all images are retrieved. Returns false if there is a | 49 // Returns true if all images are retrieved. Returns false if there is a |
| 45 // database error. In this case, the state of images is undefined; it may have | 50 // database error. In this case, the state of images is undefined; it may have |
| 46 // partial results or no results from the call. | 51 // partial results or no results from the call. |
| 47 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); | 52 bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images); |
| 48 | 53 |
| 49 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); | 54 bool SetWebAppHasAllImages(const GURL& url, bool has_all_images); |
| 50 bool GetWebAppHasAllImages(const GURL& url); | 55 bool GetWebAppHasAllImages(const GURL& url); |
| 51 | 56 |
| 52 bool RemoveWebApp(const GURL& url); | 57 bool RemoveWebApp(const GURL& url); |
| 53 | 58 |
| 54 private: | 59 private: |
| 55 bool InitWebAppIconsTable(); | 60 bool InitWebAppIconsTable(); |
| 56 bool InitWebAppsTable(); | 61 bool InitWebAppsTable(); |
| 57 | 62 |
| 58 DISALLOW_COPY_AND_ASSIGN(WebAppsTable); | 63 DISALLOW_COPY_AND_ASSIGN(WebAppsTable); |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 #endif // CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_ | 66 #endif // CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_ |
| OLD | NEW |