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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "extensions/common/permissions/permission_message_provider.h" |
18 #include "extensions/common/url_pattern.h" | 19 #include "extensions/common/url_pattern.h" |
19 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
20 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
21 #include "ui/gfx/image/image_skia.h" | 22 #include "ui/gfx/image/image_skia.h" |
22 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
23 | 24 |
24 class ExtensionInstallPromptShowParams; | 25 class ExtensionInstallPromptShowParams; |
25 class Profile; | 26 class Profile; |
26 | 27 |
27 namespace base { | 28 namespace base { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Extra information needed to display an installation or uninstallation | 103 // Extra information needed to display an installation or uninstallation |
103 // prompt. Gets populated with raw data and exposes getters for formatted | 104 // prompt. Gets populated with raw data and exposes getters for formatted |
104 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat | 105 // strings so that the GTK/views/Cocoa install dialogs don't have to repeat |
105 // that logic. | 106 // that logic. |
106 // Ref-counted because we pass around the prompt independent of the full | 107 // Ref-counted because we pass around the prompt independent of the full |
107 // ExtensionInstallPrompt. | 108 // ExtensionInstallPrompt. |
108 class Prompt : public base::RefCountedThreadSafe<Prompt> { | 109 class Prompt : public base::RefCountedThreadSafe<Prompt> { |
109 public: | 110 public: |
110 explicit Prompt(PromptType type); | 111 explicit Prompt(PromptType type); |
111 | 112 |
112 // Sets the permission list for this prompt. | 113 void SetPermissions(const extensions::PermissionMessageStrings& permissions, |
113 void SetPermissions(const std::vector<base::string16>& permissions, | |
114 PermissionsType permissions_type); | 114 PermissionsType permissions_type); |
115 // Sets the permission list details for this prompt. | |
116 void SetPermissionsDetails(const std::vector<base::string16>& details, | |
117 PermissionsType permissions_type); | |
118 void SetIsShowingDetails(DetailsType type, | 115 void SetIsShowingDetails(DetailsType type, |
119 size_t index, | 116 size_t index, |
120 bool is_showing_details); | 117 bool is_showing_details); |
121 void SetWebstoreData(const std::string& localized_user_count, | 118 void SetWebstoreData(const std::string& localized_user_count, |
122 bool show_user_count, | 119 bool show_user_count, |
123 double average_rating, | 120 double average_rating, |
124 int rating_count); | 121 int rating_count); |
125 | 122 |
126 PromptType type() const { return type_; } | 123 PromptType type() const { return type_; } |
127 void set_type(PromptType type) { type_ = type; } | 124 void set_type(PromptType type) { type_ = type; } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 Delegate* delegate_; | 461 Delegate* delegate_; |
465 | 462 |
466 // A pre-filled prompt. | 463 // A pre-filled prompt. |
467 scoped_refptr<Prompt> prompt_; | 464 scoped_refptr<Prompt> prompt_; |
468 | 465 |
469 // Used to show the confirm dialog. | 466 // Used to show the confirm dialog. |
470 ShowDialogCallback show_dialog_callback_; | 467 ShowDialogCallback show_dialog_callback_; |
471 }; | 468 }; |
472 | 469 |
473 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ | 470 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INSTALL_PROMPT_H_ |
OLD | NEW |