| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 STATUS_INIT, // Data initialized with app id. | 47 STATUS_INIT, // Data initialized with app id. |
| 48 STATUS_LOADING, // Loading data from cache or web store. | 48 STATUS_LOADING, // Loading data from cache or web store. |
| 49 STATUS_LOADED, // Data loaded. | 49 STATUS_LOADED, // Data loaded. |
| 50 STATUS_ERROR, // Failed to load data. | 50 STATUS_ERROR, // Failed to load data. |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 KioskAppData(KioskAppDataDelegate* delegate, | 53 KioskAppData(KioskAppDataDelegate* delegate, |
| 54 const std::string& app_id, | 54 const std::string& app_id, |
| 55 const std::string& user_id, | 55 const std::string& user_id, |
| 56 const GURL& update_url); | 56 const GURL& update_url); |
| 57 virtual ~KioskAppData(); | 57 ~KioskAppData() override; |
| 58 | 58 |
| 59 // Loads app data from cache. If there is no cached data, fetches it | 59 // Loads app data from cache. If there is no cached data, fetches it |
| 60 // from web store. | 60 // from web store. |
| 61 void Load(); | 61 void Load(); |
| 62 | 62 |
| 63 // Clears locally cached data. | 63 // Clears locally cached data. |
| 64 void ClearCache(); | 64 void ClearCache(); |
| 65 | 65 |
| 66 // Loads app data from the app installed in the given profile. | 66 // Loads app data from the app installed in the given profile. |
| 67 void LoadFromInstalledApp(Profile* profile, const extensions::Extension* app); | 67 void LoadFromInstalledApp(Profile* profile, const extensions::Extension* app); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void OnIconLoadFailure(); | 106 void OnIconLoadFailure(); |
| 107 | 107 |
| 108 // Callbacks for WebstoreDataParser | 108 // Callbacks for WebstoreDataParser |
| 109 void OnWebstoreParseSuccess(const SkBitmap& icon); | 109 void OnWebstoreParseSuccess(const SkBitmap& icon); |
| 110 void OnWebstoreParseFailure(); | 110 void OnWebstoreParseFailure(); |
| 111 | 111 |
| 112 // Starts to fetch data from web store. | 112 // Starts to fetch data from web store. |
| 113 void StartFetch(); | 113 void StartFetch(); |
| 114 | 114 |
| 115 // extensions::WebstoreDataFetcherDelegate overrides: | 115 // extensions::WebstoreDataFetcherDelegate overrides: |
| 116 virtual void OnWebstoreRequestFailure() override; | 116 void OnWebstoreRequestFailure() override; |
| 117 virtual void OnWebstoreResponseParseSuccess( | 117 void OnWebstoreResponseParseSuccess( |
| 118 scoped_ptr<base::DictionaryValue> webstore_data) override; | 118 scoped_ptr<base::DictionaryValue> webstore_data) override; |
| 119 virtual void OnWebstoreResponseParseFailure( | 119 void OnWebstoreResponseParseFailure(const std::string& error) override; |
| 120 const std::string& error) override; | |
| 121 | 120 |
| 122 // Helper function for testing for the existence of |key| in | 121 // Helper function for testing for the existence of |key| in |
| 123 // |response|. Passes |key|'s content via |value| and returns | 122 // |response|. Passes |key|'s content via |value| and returns |
| 124 // true when |key| is present. | 123 // true when |key| is present. |
| 125 bool CheckResponseKeyValue(const base::DictionaryValue* response, | 124 bool CheckResponseKeyValue(const base::DictionaryValue* response, |
| 126 const char* key, | 125 const char* key, |
| 127 std::string* value); | 126 std::string* value); |
| 128 | 127 |
| 129 KioskAppDataDelegate* delegate_; // not owned. | 128 KioskAppDataDelegate* delegate_; // not owned. |
| 130 Status status_; | 129 Status status_; |
| 131 | 130 |
| 132 std::string app_id_; | 131 std::string app_id_; |
| 133 std::string user_id_; | 132 std::string user_id_; |
| 134 std::string name_; | 133 std::string name_; |
| 135 GURL update_url_; | 134 GURL update_url_; |
| 136 gfx::ImageSkia icon_; | 135 gfx::ImageSkia icon_; |
| 137 scoped_refptr<base::RefCountedString> raw_icon_; | 136 scoped_refptr<base::RefCountedString> raw_icon_; |
| 138 | 137 |
| 139 scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_; | 138 scoped_ptr<extensions::WebstoreDataFetcher> webstore_fetcher_; |
| 140 base::FilePath icon_path_; | 139 base::FilePath icon_path_; |
| 141 | 140 |
| 142 DISALLOW_COPY_AND_ASSIGN(KioskAppData); | 141 DISALLOW_COPY_AND_ASSIGN(KioskAppData); |
| 143 }; | 142 }; |
| 144 | 143 |
| 145 } // namespace chromeos | 144 } // namespace chromeos |
| 146 | 145 |
| 147 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ | 146 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_DATA_H_ |
| OLD | NEW |