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_EXTENSIONS_CONVERT_USER_SCRIPT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CONVERT_USER_SCRIPT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_CONVERT_USER_SCRIPT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CONVERT_USER_SCRIPT_H_ |
7 #pragma once | |
8 | 7 |
9 #include <string> | 8 #include <string> |
10 | 9 |
11 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
12 #include "base/string16.h" | 11 #include "base/string16.h" |
13 | 12 |
14 class FilePath; | 13 class FilePath; |
15 class GURL; | 14 class GURL; |
16 | 15 |
17 namespace extensions { | 16 namespace extensions { |
18 class Extension; | 17 class Extension; |
19 } | 18 } |
20 | 19 |
21 // Wraps the specified user script in an extension. The extension is created | 20 // Wraps the specified user script in an extension. The extension is created |
22 // unpacked in the system temp dir. Returns a valid extension that the caller | 21 // unpacked in the system temp dir. Returns a valid extension that the caller |
23 // should take ownership on success, or NULL and |error| on failure. | 22 // should take ownership on success, or NULL and |error| on failure. |
24 // | 23 // |
25 // NOTE: This function does file IO and should not be called on the UI thread. | 24 // NOTE: This function does file IO and should not be called on the UI thread. |
26 // NOTE: The caller takes ownership of the directory at extension->path() on the | 25 // NOTE: The caller takes ownership of the directory at extension->path() on the |
27 // returned object. | 26 // returned object. |
28 scoped_refptr<extensions::Extension> ConvertUserScriptToExtension( | 27 scoped_refptr<extensions::Extension> ConvertUserScriptToExtension( |
29 const FilePath& user_script, const GURL& original_url, string16* error); | 28 const FilePath& user_script, const GURL& original_url, string16* error); |
30 | 29 |
31 #endif // CHROME_BROWSER_EXTENSIONS_CONVERT_USER_SCRIPT_H_ | 30 #endif // CHROME_BROWSER_EXTENSIONS_CONVERT_USER_SCRIPT_H_ |
OLD | NEW |