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_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 virtual void OnExtensionLinkClicked( | 107 virtual void OnExtensionLinkClicked( |
108 const std::string& id, | 108 const std::string& id, |
109 WindowOpenDisposition disposition) OVERRIDE; | 109 WindowOpenDisposition disposition) OVERRIDE; |
110 virtual void OnSuggestionsLinkClicked( | 110 virtual void OnSuggestionsLinkClicked( |
111 WindowOpenDisposition disposition) OVERRIDE; | 111 WindowOpenDisposition disposition) OVERRIDE; |
112 virtual void OnUserCancelledPickerDialog() OVERRIDE; | 112 virtual void OnUserCancelledPickerDialog() OVERRIDE; |
113 virtual void OnChooseAnotherService() OVERRIDE; | 113 virtual void OnChooseAnotherService() OVERRIDE; |
114 virtual void OnClosing() OVERRIDE; | 114 virtual void OnClosing() OVERRIDE; |
115 | 115 |
116 // extensions::WebstoreInstaller::Delegate implementation. | 116 // extensions::WebstoreInstaller::Delegate implementation. |
| 117 virtual void OnExtensionDownloadStarted(const std::string& id, |
| 118 content::DownloadItem* item) OVERRIDE; |
| 119 virtual void OnExtensionDownloadProgress( |
| 120 const std::string& id, |
| 121 content::DownloadItem* item) OVERRIDE; |
117 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; | 122 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE; |
118 virtual void OnExtensionInstallFailure(const std::string& id, | 123 virtual void OnExtensionInstallFailure( |
119 const std::string& error) OVERRIDE; | 124 const std::string& id, |
| 125 const std::string& error, |
| 126 extensions::WebstoreInstaller::FailureReason reason) OVERRIDE; |
120 | 127 |
121 private: | 128 private: |
122 explicit WebIntentPickerController(content::WebContents* web_contents); | 129 explicit WebIntentPickerController(content::WebContents* web_contents); |
123 static int kUserDataKey; | 130 static int kUserDataKey; |
124 friend class WebContentsUserData<WebIntentPickerController>; | 131 friend class WebContentsUserData<WebIntentPickerController>; |
125 | 132 |
126 friend class WebIntentPickerControllerTest; | 133 friend class WebIntentPickerControllerTest; |
127 friend class WebIntentPickerControllerBrowserTest; | 134 friend class WebIntentPickerControllerBrowserTest; |
128 friend class WebIntentPickerControllerIncognitoBrowserTest; | 135 friend class WebIntentPickerControllerIncognitoBrowserTest; |
129 friend class WebIntentsButtonDecorationTest; | 136 friend class WebIntentsButtonDecorationTest; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void ClosePicker(); | 249 void ClosePicker(); |
243 | 250 |
244 // Re-starts the process of showing the dialog, suppressing any default | 251 // Re-starts the process of showing the dialog, suppressing any default |
245 // queries. Called on the user clicking Use-Another-Service. | 252 // queries. Called on the user clicking Use-Another-Service. |
246 void ReshowDialog(); | 253 void ReshowDialog(); |
247 | 254 |
248 // Delegate for ShowDialog and ReshowDialog. Starts all the data queries for | 255 // Delegate for ShowDialog and ReshowDialog. Starts all the data queries for |
249 // loading the picker model and showing the dialog. | 256 // loading the picker model and showing the dialog. |
250 void ShowDialog(bool suppress_defaults); | 257 void ShowDialog(bool suppress_defaults); |
251 | 258 |
| 259 // Cancel a pending download if any. |
| 260 void CancelDownload(); |
| 261 |
252 WebIntentPickerState dialog_state_; // Current state of the dialog. | 262 WebIntentPickerState dialog_state_; // Current state of the dialog. |
253 | 263 |
254 // A weak pointer to the web contents that the picker is displayed on. | 264 // A weak pointer to the web contents that the picker is displayed on. |
255 content::WebContents* web_contents_; | 265 content::WebContents* web_contents_; |
256 | 266 |
257 // A weak pointer to the profile for the web contents. | 267 // A weak pointer to the profile for the web contents. |
258 Profile* profile_; | 268 Profile* profile_; |
259 | 269 |
260 // A notification registrar, listening for notifications when the tab closes | 270 // A notification registrar, listening for notifications when the tab closes |
261 // to close the picker ui. | 271 // to close the picker ui. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Weak pointers for the dispatcher OnSendReturnMessage will not be | 335 // Weak pointers for the dispatcher OnSendReturnMessage will not be |
326 // cancelled on picker close. | 336 // cancelled on picker close. |
327 base::WeakPtrFactory<WebIntentPickerController> dispatcher_factory_; | 337 base::WeakPtrFactory<WebIntentPickerController> dispatcher_factory_; |
328 | 338 |
329 // Bucket identifier for UMA reporting. Saved off in a field | 339 // Bucket identifier for UMA reporting. Saved off in a field |
330 // to avoid repeated calculation of the bucket across | 340 // to avoid repeated calculation of the bucket across |
331 // multiple UMA calls. Should be recalculated each time | 341 // multiple UMA calls. Should be recalculated each time |
332 // |intents_dispatcher_| is set. | 342 // |intents_dispatcher_| is set. |
333 web_intents::UMABucket uma_bucket_; | 343 web_intents::UMABucket uma_bucket_; |
334 | 344 |
| 345 // The ID of a pending extension download. |
| 346 content::DownloadId download_id_; |
| 347 |
335 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); | 348 DISALLOW_COPY_AND_ASSIGN(WebIntentPickerController); |
336 }; | 349 }; |
337 | 350 |
338 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ | 351 #endif // CHROME_BROWSER_UI_INTENTS_WEB_INTENT_PICKER_CONTROLLER_H_ |
OLD | NEW |