OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_CONVERT_WEB_APP_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 | 12 |
13 class Extension; | 13 class Extension; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class Time; | 16 class Time; |
17 } | 17 } |
18 | 18 |
19 namespace webkit_glue { | 19 namespace webkit_glue { |
20 struct WebApplicationInfo; | 20 class WebApplicationInfo; |
21 } | 21 } |
22 | 22 |
23 // Generates a version number for an extension from a time. The goal is to make | 23 // Generates a version number for an extension from a time. The goal is to make |
24 // use of the version number to communicate some useful information. The | 24 // use of the version number to communicate some useful information. The |
25 // returned version has the format: | 25 // returned version has the format: |
26 // <year>.<month><day>.<upper 16 bits of unix timestamp>.<lower 16 bits> | 26 // <year>.<month><day>.<upper 16 bits of unix timestamp>.<lower 16 bits> |
27 std::string ConvertTimeToExtensionVersion(const base::Time& time); | 27 std::string ConvertTimeToExtensionVersion(const base::Time& time); |
28 | 28 |
29 // Wraps the specified web app in an extension. The extension is created | 29 // Wraps the specified web app in an extension. The extension is created |
30 // unpacked in the system temp dir. Returns a valid extension that the caller | 30 // unpacked in the system temp dir. Returns a valid extension that the caller |
31 // should take ownership on success, or NULL and |error| on failure. | 31 // should take ownership on success, or NULL and |error| on failure. |
32 // | 32 // |
33 // NOTE: This function does file IO and should not be called on the UI thread. | 33 // NOTE: This function does file IO and should not be called on the UI thread. |
34 // NOTE: The caller takes ownership of the directory at extension->path() on the | 34 // NOTE: The caller takes ownership of the directory at extension->path() on the |
35 // returned object. | 35 // returned object. |
36 scoped_refptr<Extension> ConvertWebAppToExtension( | 36 scoped_refptr<Extension> ConvertWebAppToExtension( |
37 const webkit_glue::WebApplicationInfo& web_app_info, | 37 const webkit_glue::WebApplicationInfo& web_app_info, |
38 const base::Time& create_time); | 38 const base::Time& create_time); |
39 | 39 |
40 #endif // CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_ | 40 #endif // CHROME_BROWSER_EXTENSIONS_CONVERT_WEB_APP_H_ |
OLD | NEW |