OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROMPT_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 // Displays all the UI around extension installation. | 49 // Displays all the UI around extension installation. |
50 class ExtensionInstallPrompt { | 50 class ExtensionInstallPrompt { |
51 public: | 51 public: |
52 // This enum is associated with Extensions.InstallPrompt_Type UMA histogram. | 52 // This enum is associated with Extensions.InstallPrompt_Type UMA histogram. |
53 // Do not modify existing values and add new values only to the end. | 53 // Do not modify existing values and add new values only to the end. |
54 enum PromptType { | 54 enum PromptType { |
55 UNSET_PROMPT_TYPE = -1, | 55 UNSET_PROMPT_TYPE = -1, |
56 INSTALL_PROMPT = 0, | 56 INSTALL_PROMPT = 0, |
57 INLINE_INSTALL_PROMPT, | 57 INLINE_INSTALL_PROMPT = 1, |
58 BUNDLE_INSTALL_PROMPT_DEPRECATED, | 58 // BUNDLE_INSTALL_PROMPT_DEPRECATED = 2, |
59 RE_ENABLE_PROMPT, | 59 RE_ENABLE_PROMPT = 3, |
60 PERMISSIONS_PROMPT, | 60 PERMISSIONS_PROMPT = 4, |
61 EXTERNAL_INSTALL_PROMPT, | 61 EXTERNAL_INSTALL_PROMPT = 5, |
62 POST_INSTALL_PERMISSIONS_PROMPT, | 62 POST_INSTALL_PERMISSIONS_PROMPT = 6, |
63 LAUNCH_PROMPT_DEPRECATED, | 63 // LAUNCH_PROMPT_DEPRECATED = 7, |
64 REMOTE_INSTALL_PROMPT, | 64 REMOTE_INSTALL_PROMPT = 8, |
65 REPAIR_PROMPT, | 65 REPAIR_PROMPT = 9, |
66 DELEGATED_PERMISSIONS_PROMPT, | 66 DELEGATED_PERMISSIONS_PROMPT = 10, |
67 DELEGATED_BUNDLE_PERMISSIONS_PROMPT_DEPRECATED, | 67 // DELEGATED_BUNDLE_PERMISSIONS_PROMPT_DEPRECATED = 11, |
68 NUM_PROMPT_TYPES | 68 NUM_PROMPT_TYPES = 12, |
69 }; | 69 }; |
70 | 70 |
71 // The last prompt type to display; only used for testing. | 71 // The last prompt type to display; only used for testing. |
72 static PromptType g_last_prompt_type_for_tests; | 72 static PromptType g_last_prompt_type_for_tests; |
73 | 73 |
74 // Enumeration for permissions and retained files details. | 74 // Enumeration for permissions and retained files details. |
75 enum DetailsType { | 75 enum DetailsType { |
76 PERMISSIONS_DETAILS = 0, | 76 PERMISSIONS_DETAILS = 0, |
77 WITHHELD_PERMISSIONS_DETAILS, | 77 WITHHELD_PERMISSIONS_DETAILS, |
78 RETAINED_FILES_DETAILS, | 78 RETAINED_FILES_DETAILS, |
(...skipping 23 matching lines...) Expand all Loading... |
102 PermissionsType permissions_type); | 102 PermissionsType permissions_type); |
103 void SetIsShowingDetails(DetailsType type, | 103 void SetIsShowingDetails(DetailsType type, |
104 size_t index, | 104 size_t index, |
105 bool is_showing_details); | 105 bool is_showing_details); |
106 void SetWebstoreData(const std::string& localized_user_count, | 106 void SetWebstoreData(const std::string& localized_user_count, |
107 bool show_user_count, | 107 bool show_user_count, |
108 double average_rating, | 108 double average_rating, |
109 int rating_count); | 109 int rating_count); |
110 | 110 |
111 PromptType type() const { return type_; } | 111 PromptType type() const { return type_; } |
112 void set_type(PromptType type) { type_ = type; } | |
113 | 112 |
114 // Getters for UI element labels. | 113 // Getters for UI element labels. |
115 base::string16 GetDialogTitle() const; | 114 base::string16 GetDialogTitle() const; |
116 int GetDialogButtons() const; | 115 int GetDialogButtons() const; |
117 // Returns the empty string when there should be no "accept" button. | 116 // Returns the empty string when there should be no "accept" button. |
118 base::string16 GetAcceptButtonLabel() const; | 117 base::string16 GetAcceptButtonLabel() const; |
119 base::string16 GetAbortButtonLabel() const; | 118 base::string16 GetAbortButtonLabel() const; |
120 base::string16 GetPermissionsHeading( | 119 base::string16 GetPermissionsHeading( |
121 PermissionsType permissions_type) const; | 120 PermissionsType permissions_type) const; |
122 base::string16 GetRetainedFilesHeading() const; | 121 base::string16 GetRetainedFilesHeading() const; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 191 |
193 // Returns the InstallPromptPermissions corresponding to | 192 // Returns the InstallPromptPermissions corresponding to |
194 // |permissions_type|. | 193 // |permissions_type|. |
195 InstallPromptPermissions& GetPermissionsForType( | 194 InstallPromptPermissions& GetPermissionsForType( |
196 PermissionsType permissions_type); | 195 PermissionsType permissions_type); |
197 const InstallPromptPermissions& GetPermissionsForType( | 196 const InstallPromptPermissions& GetPermissionsForType( |
198 PermissionsType permissions_type) const; | 197 PermissionsType permissions_type) const; |
199 | 198 |
200 bool ShouldDisplayRevokeFilesButton() const; | 199 bool ShouldDisplayRevokeFilesButton() const; |
201 | 200 |
202 PromptType type_; | 201 const PromptType type_; |
203 | 202 |
204 // Permissions that are being requested (may not be all of an extension's | 203 // Permissions that are being requested (may not be all of an extension's |
205 // permissions if only additional ones are being requested) | 204 // permissions if only additional ones are being requested) |
206 InstallPromptPermissions prompt_permissions_; | 205 InstallPromptPermissions prompt_permissions_; |
207 // Permissions that will be withheld upon install. | 206 // Permissions that will be withheld upon install. |
208 InstallPromptPermissions withheld_prompt_permissions_; | 207 InstallPromptPermissions withheld_prompt_permissions_; |
209 | 208 |
210 bool is_showing_details_for_retained_files_; | 209 bool is_showing_details_for_retained_files_; |
211 bool is_showing_details_for_retained_devices_; | 210 bool is_showing_details_for_retained_devices_; |
212 | 211 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 382 |
384 // Whether or not the |show_dialog_callback_| was called. | 383 // Whether or not the |show_dialog_callback_| was called. |
385 bool did_call_show_dialog_; | 384 bool did_call_show_dialog_; |
386 | 385 |
387 base::WeakPtrFactory<ExtensionInstallPrompt> weak_factory_; | 386 base::WeakPtrFactory<ExtensionInstallPrompt> weak_factory_; |
388 | 387 |
389 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt); | 388 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallPrompt); |
390 }; | 389 }; |
391 | 390 |
392 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 391 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
OLD | NEW |