Home | History | Annotate | Download | only in webdata
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_
      6 #define CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_
      7 #pragma once
      8 
      9 #include <vector>
     10 
     11 #include "chrome/browser/webdata/web_database_table.h"
     12 
     13 class GURL;
     14 class SkBitmap;
     15 
     16 // This class manages the WebApps tables within the SQLite database passed to
     17 // the constructor. It expects the following schema:
     18 //
     19 // Note: The database stores time in seconds, UTC.
     20 //
     21 // web_apps
     22 //   url                 URL of the web app.
     23 //   has_all_images      Do we have all the images?
     24 //
     25 // web_app_icons
     26 //   url         URL of the web app.
     27 //   width       Width of the image.
     28 //   height      Height of the image.
     29 //   image       PNG encoded image data.
     30 //
     31 class WebAppsTable : public WebDatabaseTable {
     32  public:
     33   WebAppsTable(sql::Connection* db, sql::MetaTable* meta_table)
     34       : WebDatabaseTable(db, meta_table) {}
     35   virtual ~WebAppsTable() {}
     36   virtual bool Init();
     37   virtual bool IsSyncable();
     38 
     39   bool SetWebAppImage(const GURL& url, const SkBitmap& image);
     40   bool GetWebAppImages(const GURL& url, std::vector<SkBitmap>* images);
     41 
     42   bool SetWebAppHasAllImages(const GURL& url, bool has_all_images);
     43   bool GetWebAppHasAllImages(const GURL& url);
     44 
     45   bool RemoveWebApp(const GURL& url);
     46 
     47  private:
     48   bool InitWebAppIconsTable();
     49   bool InitWebAppsTable();
     50 
     51   DISALLOW_COPY_AND_ASSIGN(WebAppsTable);
     52 };
     53 
     54 #endif  // CHROME_BROWSER_WEBDATA_WEB_APPS_TABLE_H_
     55