OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_EXTERNAL_INSTALL_ERROR_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/extensions/extension_install_prompt.h" | 13 #include "chrome/browser/extensions/extension_install_prompt.h" |
14 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" | 14 #include "chrome/browser/extensions/webstore_data_fetcher_delegate.h" |
15 | 15 |
16 class Browser; | 16 class Browser; |
17 class ExtensionInstallPromptShowParams; | 17 class ExtensionInstallPromptShowParams; |
18 class ExtensionInstallUI; | 18 class ExtensionInstallUI; |
19 class GlobalError; | 19 class GlobalError; |
20 class GlobalErrorService; | 20 class GlobalErrorService; |
21 | 21 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Return the associated extension, or NULL. | 62 // Return the associated extension, or NULL. |
63 const Extension* GetExtension() const; | 63 const Extension* GetExtension() const; |
64 | 64 |
65 const std::string& extension_id() const { return extension_id_; } | 65 const std::string& extension_id() const { return extension_id_; } |
66 AlertType alert_type() const { return alert_type_; } | 66 AlertType alert_type() const { return alert_type_; } |
67 | 67 |
68 private: | 68 private: |
69 // WebstoreDataFetcherDelegate implementation. | 69 // WebstoreDataFetcherDelegate implementation. |
70 void OnWebstoreRequestFailure() override; | 70 void OnWebstoreRequestFailure() override; |
71 void OnWebstoreResponseParseSuccess( | 71 void OnWebstoreResponseParseSuccess( |
72 scoped_ptr<base::DictionaryValue> webstore_data) override; | 72 std::unique_ptr<base::DictionaryValue> webstore_data) override; |
73 void OnWebstoreResponseParseFailure(const std::string& error) override; | 73 void OnWebstoreResponseParseFailure(const std::string& error) override; |
74 | 74 |
75 // Called when data fetching has completed (either successfully or not). | 75 // Called when data fetching has completed (either successfully or not). |
76 void OnFetchComplete(); | 76 void OnFetchComplete(); |
77 | 77 |
78 // Called when the dialog has been successfully populated, and is ready to be | 78 // Called when the dialog has been successfully populated, and is ready to be |
79 // shown. | 79 // shown. |
80 void OnDialogReady(ExtensionInstallPromptShowParams* show_params, | 80 void OnDialogReady(ExtensionInstallPromptShowParams* show_params, |
81 const ExtensionInstallPrompt::DoneCallback& done_callback, | 81 const ExtensionInstallPrompt::DoneCallback& done_callback, |
82 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt); | 82 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt); |
83 | 83 |
84 // Removes the error. | 84 // Removes the error. |
85 void RemoveError(); | 85 void RemoveError(); |
86 | 86 |
87 // The associated BrowserContext. | 87 // The associated BrowserContext. |
88 content::BrowserContext* browser_context_; | 88 content::BrowserContext* browser_context_; |
89 | 89 |
90 // The id of the external extension. | 90 // The id of the external extension. |
91 std::string extension_id_; | 91 std::string extension_id_; |
92 | 92 |
93 // The type of alert to show the user. | 93 // The type of alert to show the user. |
94 AlertType alert_type_; | 94 AlertType alert_type_; |
95 | 95 |
96 // The owning ExternalInstallManager. | 96 // The owning ExternalInstallManager. |
97 ExternalInstallManager* manager_; | 97 ExternalInstallManager* manager_; |
98 | 98 |
99 // The associated GlobalErrorService. | 99 // The associated GlobalErrorService. |
100 GlobalErrorService* error_service_; | 100 GlobalErrorService* error_service_; |
101 | 101 |
102 // The UI for showing the error. | 102 // The UI for showing the error. |
103 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 103 std::unique_ptr<ExtensionInstallPrompt> install_ui_; |
104 scoped_ptr<ExtensionInstallPromptShowParams> install_ui_show_params_; | 104 std::unique_ptr<ExtensionInstallPromptShowParams> install_ui_show_params_; |
105 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt_; | 105 std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt_; |
106 | 106 |
107 // The UI for the given error, which will take the form of either a menu | 107 // The UI for the given error, which will take the form of either a menu |
108 // alert or a bubble alert (depending on the |alert_type_|. | 108 // alert or a bubble alert (depending on the |alert_type_|. |
109 scoped_ptr<GlobalError> global_error_; | 109 std::unique_ptr<GlobalError> global_error_; |
110 | 110 |
111 // The WebstoreDataFetcher to use in order to populate the error with webstore | 111 // The WebstoreDataFetcher to use in order to populate the error with webstore |
112 // information of the extension. | 112 // information of the extension. |
113 scoped_ptr<WebstoreDataFetcher> webstore_data_fetcher_; | 113 std::unique_ptr<WebstoreDataFetcher> webstore_data_fetcher_; |
114 | 114 |
115 base::WeakPtrFactory<ExternalInstallError> weak_factory_; | 115 base::WeakPtrFactory<ExternalInstallError> weak_factory_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(ExternalInstallError); | 117 DISALLOW_COPY_AND_ASSIGN(ExternalInstallError); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace extensions | 120 } // namespace extensions |
121 | 121 |
122 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_ | 122 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_ERROR_H_ |
OLD | NEW |