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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 PERMISSIONS_PROMPT, | 54 PERMISSIONS_PROMPT, |
55 NUM_PROMPT_TYPES | 55 NUM_PROMPT_TYPES |
56 }; | 56 }; |
57 | 57 |
58 // Extra information needed to display an installation or uninstallation | 58 // Extra information needed to display an installation or uninstallation |
59 // prompt. Gets populated with raw data and exposes getters for formatted | 59 // prompt. Gets populated with raw data and exposes getters for formatted |
60 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat | 60 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat |
61 // that logic. | 61 // that logic. |
62 class Prompt { | 62 class Prompt { |
63 public: | 63 public: |
64 explicit Prompt(PromptType type); | 64 Prompt(Profile* profile, PromptType type); |
65 ~Prompt(); | 65 ~Prompt(); |
66 | 66 |
67 void SetPermissions(const std::vector<string16>& permissions); | 67 void SetPermissions(const std::vector<string16>& permissions); |
68 void SetInlineInstallWebstoreData(const std::string& localized_user_count, | 68 void SetInlineInstallWebstoreData(const std::string& localized_user_count, |
69 double average_rating, | 69 double average_rating, |
70 int rating_count); | 70 int rating_count); |
71 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); | 71 void SetOAuthIssueAdvice(const IssueAdviceInfo& issue_advice); |
72 | 72 |
73 PromptType type() const { return type_; } | 73 PromptType type() const { return type_; } |
74 void set_type(PromptType type) { type_ = type; } | 74 void set_type(PromptType type) { type_ = type; } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // The icon to be displayed. | 130 // The icon to be displayed. |
131 gfx::Image icon_; | 131 gfx::Image icon_; |
132 | 132 |
133 // These fields are populated only when the prompt type is | 133 // These fields are populated only when the prompt type is |
134 // INLINE_INSTALL_PROMPT | 134 // INLINE_INSTALL_PROMPT |
135 // Already formatted to be locale-specific. | 135 // Already formatted to be locale-specific. |
136 std::string localized_user_count_; | 136 std::string localized_user_count_; |
137 // Range is kMinExtensionRating to kMaxExtensionRating | 137 // Range is kMinExtensionRating to kMaxExtensionRating |
138 double average_rating_; | 138 double average_rating_; |
139 int rating_count_; | 139 int rating_count_; |
| 140 |
| 141 Profile* profile_; |
140 }; | 142 }; |
141 | 143 |
142 static const int kMinExtensionRating = 0; | 144 static const int kMinExtensionRating = 0; |
143 static const int kMaxExtensionRating = 5; | 145 static const int kMaxExtensionRating = 5; |
144 | 146 |
145 class Delegate { | 147 class Delegate { |
146 public: | 148 public: |
147 // We call this method to signal that the installation should continue. | 149 // We call this method to signal that the installation should continue. |
148 virtual void InstallUIProceed() = 0; | 150 virtual void InstallUIProceed() = 0; |
149 | 151 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 321 |
320 // Creates an ExtensionInstallPrompt from |browser|. Caller assumes ownership. | 322 // Creates an ExtensionInstallPrompt from |browser|. Caller assumes ownership. |
321 // TODO(beng): remove this once various extensions types are weaned from | 323 // TODO(beng): remove this once various extensions types are weaned from |
322 // Browser. | 324 // Browser. |
323 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser( | 325 ExtensionInstallPrompt* CreateExtensionInstallPromptWithBrowser( |
324 Browser* browser); | 326 Browser* browser); |
325 | 327 |
326 } // namespace chrome | 328 } // namespace chrome |
327 | 329 |
328 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 330 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
OLD | NEW |