| 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 IOS_CHROME_BROWSER_UI_DOWNLOADS_DOWNLOAD_MANAGER_CONTROLLER_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_DOWNLOADS_DOWNLOAD_MANAGER_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_DOWNLOADS_DOWNLOAD_MANAGER_CONTROLLER_H_ | 6 #define IOS_CHROME_BROWSER_UI_DOWNLOADS_DOWNLOAD_MANAGER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 #import "ios/chrome/browser/ui/native_content_controller.h" | 10 #import "ios/chrome/browser/ui/native_content_controller.h" |
| 11 | 11 |
| 12 @protocol StoreKitLauncher; | 12 namespace web { |
| 13 | 13 class WebState; |
| 14 namespace net { | 14 } // namespace web |
| 15 class URLRequestContextGetter; | |
| 16 } | |
| 17 | 15 |
| 18 // This controller shows the native download manager. It shows the user basic | 16 // This controller shows the native download manager. It shows the user basic |
| 19 // information about the file (namely its type, size, and name), and gives them | 17 // information about the file (namely its type, size, and name), and gives them |
| 20 // the option to download it and open it in another app. This controller is | 18 // the option to download it and open it in another app. This controller is |
| 21 // displayed when a URL is loaded that contains a file type that UIWebView | 19 // displayed when a URL is loaded that contains a file type that UIWebView |
| 22 // cannot display itself. | 20 // cannot display itself. |
| 23 @interface DownloadManagerController | 21 @interface DownloadManagerController |
| 24 : NativeContentController<UIDocumentInteractionControllerDelegate> | 22 : NativeContentController<UIDocumentInteractionControllerDelegate> |
| 25 | 23 |
| 26 // Initializes a controller for content from |url|, using | 24 // Initializes a controller for content from |url| using |webState| to provide |
| 27 // |requestContextGetter| for all requests necessary to download the file. | 25 // the context to open a controller that allows the user to install Google Drive |
| 28 // |storeLauncher| is used to open a controller that allows the user to | 26 // if they don't have it installed. |
| 29 // install Google Drive if they don't have it installed. | 27 - (instancetype)initWithWebState:(web::WebState*)webState |
| 30 - (id)initWithURL:(const GURL&)url | 28 downloadURL:(const GURL&)url; |
| 31 requestContextGetter:(net::URLRequestContextGetter*)requestContextGetter | |
| 32 storeKitLauncher:(id<StoreKitLauncher>)storeLauncher; | |
| 33 | 29 |
| 34 // Starts loading the data for the file at the url passed into the | 30 // Starts loading the data for the file at the url passed into the |
| 35 // initializer. This should only be called once, immediately after | 31 // initializer. This should only be called once, immediately after |
| 36 // initialization. | 32 // initialization. |
| 37 - (void)start; | 33 - (void)start; |
| 38 | 34 |
| 39 // Deletes the directory in which downloaded files are saved. It should only be | 35 // Deletes the directory in which downloaded files are saved. It should only be |
| 40 // called on the UI thread. | 36 // called on the UI thread. |
| 41 + (void)clearDownloadsDirectory; | 37 + (void)clearDownloadsDirectory; |
| 42 | 38 |
| 43 @end | 39 @end |
| 44 | 40 |
| 45 #endif // IOS_CHROME_BROWSER_UI_DOWNLOADS_DOWNLOAD_MANAGER_CONTROLLER_H_ | 41 #endif // IOS_CHROME_BROWSER_UI_DOWNLOADS_DOWNLOAD_MANAGER_CONTROLLER_H_ |
| OLD | NEW |