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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 public base::SupportsWeakPtr<ExtensionInstallPrompt> { | 49 public base::SupportsWeakPtr<ExtensionInstallPrompt> { |
50 public: | 50 public: |
51 enum PromptType { | 51 enum PromptType { |
52 UNSET_PROMPT_TYPE = -1, | 52 UNSET_PROMPT_TYPE = -1, |
53 INSTALL_PROMPT = 0, | 53 INSTALL_PROMPT = 0, |
54 INLINE_INSTALL_PROMPT, | 54 INLINE_INSTALL_PROMPT, |
55 BUNDLE_INSTALL_PROMPT, | 55 BUNDLE_INSTALL_PROMPT, |
56 RE_ENABLE_PROMPT, | 56 RE_ENABLE_PROMPT, |
57 PERMISSIONS_PROMPT, | 57 PERMISSIONS_PROMPT, |
58 EXTERNAL_INSTALL_PROMPT, | 58 EXTERNAL_INSTALL_PROMPT, |
| 59 POST_INSTALL_PERMISSIONS_PROMPT, |
59 NUM_PROMPT_TYPES | 60 NUM_PROMPT_TYPES |
60 }; | 61 }; |
61 | 62 |
62 // Extra information needed to display an installation or uninstallation | 63 // Extra information needed to display an installation or uninstallation |
63 // prompt. Gets populated with raw data and exposes getters for formatted | 64 // prompt. Gets populated with raw data and exposes getters for formatted |
64 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat | 65 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat |
65 // that logic. | 66 // that logic. |
66 class Prompt { | 67 class Prompt { |
67 public: | 68 public: |
68 explicit Prompt(PromptType type); | 69 explicit Prompt(PromptType type); |
69 ~Prompt(); | 70 ~Prompt(); |
70 | 71 |
71 void SetPermissions(const std::vector<string16>& permissions); | 72 void SetPermissions(const std::vector<string16>& permissions); |
72 void SetInlineInstallWebstoreData(const std::string& localized_user_count, | 73 void SetInlineInstallWebstoreData(const std::string& localized_user_count, |
73 double average_rating, | 74 double average_rating, |
74 int rating_count); | 75 int rating_count); |
75 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); | 76 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); |
76 void SetUserNameFromProfile(Profile* profile); | 77 void SetUserNameFromProfile(Profile* profile); |
77 | 78 |
78 PromptType type() const { return type_; } | 79 PromptType type() const { return type_; } |
79 void set_type(PromptType type) { type_ = type; } | 80 void set_type(PromptType type) { type_ = type; } |
80 | 81 |
81 // Getters for UI element labels. | 82 // Getters for UI element labels. |
82 string16 GetDialogTitle() const; | 83 string16 GetDialogTitle() const; |
83 string16 GetHeading() const; | 84 string16 GetHeading() const; |
| 85 int GetDialogButtons() const; |
| 86 bool HasAcceptButtonLabel() const; |
84 string16 GetAcceptButtonLabel() const; | 87 string16 GetAcceptButtonLabel() const; |
85 bool HasAbortButtonLabel() const; | 88 bool HasAbortButtonLabel() const; |
86 string16 GetAbortButtonLabel() const; | 89 string16 GetAbortButtonLabel() const; |
87 string16 GetPermissionsHeading() const; | 90 string16 GetPermissionsHeading() const; |
88 string16 GetOAuthHeading() const; | 91 string16 GetOAuthHeading() const; |
89 | 92 |
90 // Getters for webstore metadata. Only populated when the type is | 93 // Getters for webstore metadata. Only populated when the type is |
91 // INLINE_INSTALL_PROMPT. | 94 // INLINE_INSTALL_PROMPT. |
92 | 95 |
93 // The star display logic replicates the one used by the webstore (from | 96 // The star display logic replicates the one used by the webstore (from |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 const extensions::PermissionSet* permissions); | 276 const extensions::PermissionSet* permissions); |
274 | 277 |
275 // This is called by the extension identity API to verify whether an | 278 // This is called by the extension identity API to verify whether an |
276 // extension can be granted an OAuth2 token. | 279 // extension can be granted an OAuth2 token. |
277 // | 280 // |
278 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. | 281 // We *MUST* eventually call either Proceed() or Abort() on |delegate|. |
279 virtual void ConfirmIssueAdvice(Delegate* delegate, | 282 virtual void ConfirmIssueAdvice(Delegate* delegate, |
280 const extensions::Extension* extension, | 283 const extensions::Extension* extension, |
281 const IssueAdviceInfo& issue_advice); | 284 const IssueAdviceInfo& issue_advice); |
282 | 285 |
| 286 // This is called by the app handler launcher to review what permissions the |
| 287 // extension or app currently has. |
| 288 // |
| 289 // This *WILL* call Abort() on |delegate|. |
| 290 virtual void ReviewPermissions(Delegate* delegate, |
| 291 const extensions::Extension* extension); |
| 292 |
283 // Installation was successful. This is declared virtual for testing. | 293 // Installation was successful. This is declared virtual for testing. |
284 virtual void OnInstallSuccess(const extensions::Extension* extension, | 294 virtual void OnInstallSuccess(const extensions::Extension* extension, |
285 SkBitmap* icon); | 295 SkBitmap* icon); |
286 | 296 |
287 // Installation failed. This is declared virtual for testing. | 297 // Installation failed. This is declared virtual for testing. |
288 virtual void OnInstallFailure(const extensions::CrxInstallerError& error); | 298 virtual void OnInstallFailure(const extensions::CrxInstallerError& error); |
289 | 299 |
290 protected: | 300 protected: |
291 friend class extensions::ExtensionWebstorePrivateApiTest; | 301 friend class extensions::ExtensionWebstorePrivateApiTest; |
292 friend class extensions::MockGetAuthTokenFunction; | 302 friend class extensions::MockGetAuthTokenFunction; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // A pre-filled prompt. | 359 // A pre-filled prompt. |
350 Prompt prompt_; | 360 Prompt prompt_; |
351 | 361 |
352 scoped_ptr<OAuth2MintTokenFlow> token_flow_; | 362 scoped_ptr<OAuth2MintTokenFlow> token_flow_; |
353 | 363 |
354 // Used to show the confirm dialog. | 364 // Used to show the confirm dialog. |
355 ShowDialogCallback show_dialog_callback_; | 365 ShowDialogCallback show_dialog_callback_; |
356 }; | 366 }; |
357 | 367 |
358 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 368 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
OLD | NEW |