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_EXTENSION_INSTALL_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_DIALOG_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_DIALOG_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_DIALOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "chrome/browser/extensions/extension_install_ui.h" | 13 #include "chrome/browser/extensions/extension_install_ui.h" |
14 | 14 |
15 class Extension; | 15 class Extension; |
16 class Profile; | 16 class Profile; |
17 class SkBitmap; | 17 class SkBitmap; |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class DictionaryValue; | 20 class DictionaryValue; |
21 } | 21 } |
22 | 22 |
| 23 // The implementations of this function are platform-specific. |
23 void ShowExtensionInstallDialog(Profile* profile, | 24 void ShowExtensionInstallDialog(Profile* profile, |
24 ExtensionInstallUI::Delegate* delegate, | 25 ExtensionInstallUI::Delegate* delegate, |
25 const Extension* extension, | 26 const Extension* extension, |
26 SkBitmap* icon, | 27 SkBitmap* icon, |
27 const ExtensionInstallUI::Prompt& prompt); | 28 const ExtensionInstallUI::Prompt& prompt); |
28 | 29 |
29 // The implementations of this function are platform-specific. | |
30 void ShowExtensionInstallDialogImpl(Profile* profile, | |
31 ExtensionInstallUI::Delegate* delegate, | |
32 const Extension* extension, | |
33 SkBitmap* icon, | |
34 const ExtensionInstallUI::Prompt& prompt); | |
35 | |
36 // Wrapper around ShowExtensionInstallDialog that shows the install dialog for | 30 // Wrapper around ShowExtensionInstallDialog that shows the install dialog for |
37 // a given manifest (that corresponds to an extension about to be installed with | 31 // a given manifest (that corresponds to an extension about to be installed with |
38 // ID |id|). If the name or description in the manifest is a localized | 32 // ID |id|). If the name or description in the manifest is a localized |
39 // placeholder, it may be overidden with |localized_name| or | 33 // placeholder, it may be overidden with |localized_name| or |
40 // |localized_description| (which may be empty). The Extension instance | 34 // |localized_description| (which may be empty). The Extension instance |
41 // that's parsed is returned via |dummy_extension|. |prompt| should be fully | 35 // that's parsed is returned via |dummy_extension|. |prompt| should be fully |
42 // populated except for the permissions field, which will be extracted from the | 36 // populated except for the permissions field, which will be extracted from the |
43 // extension. | 37 // extension. |
44 // Returns true if |dummy_extension| is valid and delegate methods will be | 38 // Returns true if |dummy_extension| is valid and delegate methods will be |
45 // called. | 39 // called. |
46 bool ShowExtensionInstallDialogForManifest( | 40 bool ShowExtensionInstallDialogForManifest( |
47 Profile *profile, | 41 Profile *profile, |
48 ExtensionInstallUI::Delegate* delegate, | 42 ExtensionInstallUI::Delegate* delegate, |
49 const base::DictionaryValue* manifest, | 43 const base::DictionaryValue* manifest, |
50 const std::string& id, | 44 const std::string& id, |
51 const std::string& localized_name, | 45 const std::string& localized_name, |
52 const std::string& localized_description, | 46 const std::string& localized_description, |
53 SkBitmap* icon, | 47 SkBitmap* icon, |
54 const ExtensionInstallUI::Prompt& prompt, | 48 const ExtensionInstallUI::Prompt& prompt, |
55 scoped_refptr<Extension>* dummy_extension); | 49 scoped_refptr<Extension>* dummy_extension); |
56 | 50 |
57 // For use only in tests - sets a flag that makes invocations of | 51 // For use only in tests - sets a flag that makes invocations of |
58 // ShowExtensionInstallDialog* skip putting up a real dialog, and | 52 // ShowExtensionInstallDialogForManifest skip putting up a real dialog, and |
59 // instead act as if the dialog choice was to proceed or abort. | 53 // instead act as if the dialog choice was to proceed or abort. |
60 void SetExtensionInstallDialogAutoConfirmForTests( | 54 void SetExtensionInstallDialogForManifestAutoConfirmForTests( |
61 bool should_proceed); | 55 bool should_proceed); |
62 | 56 |
63 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_DIALOG_H_ | 57 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_DIALOG_H_ |
OLD | NEW |