Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/download/save_package.h" | 10 #include "chrome/browser/download/save_package.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 // Prepare for saving the URL to disk. | 30 // Prepare for saving the URL to disk. |
| 31 // URL may refer to the iframe on the page. | 31 // URL may refer to the iframe on the page. |
| 32 void OnSaveURL(const GURL& url); | 32 void OnSaveURL(const GURL& url); |
| 33 | 33 |
| 34 // Save page with the main HTML file path, the directory for saving resources, | 34 // Save page with the main HTML file path, the directory for saving resources, |
| 35 // and the save type: HTML only or complete web page. Returns true if the | 35 // and the save type: HTML only or complete web page. Returns true if the |
| 36 // saving process has been initiated successfully. | 36 // saving process has been initiated successfully. |
| 37 bool SavePage(const FilePath& main_file, const FilePath& dir_path, | 37 bool SavePage(const FilePath& main_file, const FilePath& dir_path, |
| 38 SavePackage::SavePackageType save_type); | 38 SavePackage::SavePackageType save_type); |
| 39 | 39 |
| 40 // Save page. |website_save_dir| is the default folder for saving HTML. | |
| 41 // |download_save_dir| is the default folder for saving downloaded files. | |
| 42 // |save_type| is HTML only or complete web page. | |
| 43 // Returns the title of saved page. | |
| 44 string16 SavePageToProperDirectory(const FilePath& website_save_dir, | |
| 45 const FilePath& download_save_dir, | |
| 46 SavePackage::SavePackageType save_type); | |
|
Randy Smith (Not in Mondays)
2011/05/31 23:03:10
In general, I feel better about methods that are o
haraken1
2011/06/02 09:13:22
If we simply make these methods private and add FR
haraken1
2011/06/02 09:13:22
If we simply make these methods private and add FR
Randy Smith (Not in Mondays)
2011/06/02 19:13:57
What I've always done is move the tests (but not a
haraken1
2011/06/03 06:50:26
Done.
| |
| 47 | |
| 40 // Returns the SavePackage which manages the page saving job. May be NULL. | 48 // Returns the SavePackage which manages the page saving job. May be NULL. |
| 41 SavePackage* save_package() const { return save_package_.get(); } | 49 SavePackage* save_package() const { return save_package_.get(); } |
| 42 | 50 |
| 43 // Notifies the delegate that a download is about to be started. | 51 // Notifies the delegate that a download is about to be started. |
| 44 // This notification is fired before a local temporary file has been created. | 52 // This notification is fired before a local temporary file has been created. |
| 45 bool CanDownload(int request_id); | 53 bool CanDownload(int request_id); |
| 46 | 54 |
| 47 // Notifies the delegate that a download started. | 55 // Notifies the delegate that a download started. |
| 48 void OnStartDownload(DownloadItem* download); | 56 void OnStartDownload(DownloadItem* download); |
| 49 | 57 |
| 50 private: | 58 private: |
| 51 // TabContentsObserver overrides. | 59 // TabContentsObserver overrides. |
| 52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 60 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 53 virtual void DidGetUserGesture() OVERRIDE; | 61 virtual void DidGetUserGesture() OVERRIDE; |
| 54 | 62 |
| 55 // SavePackage, lazily created. | 63 // SavePackage, lazily created. |
| 56 scoped_refptr<SavePackage> save_package_; | 64 scoped_refptr<SavePackage> save_package_; |
| 57 | 65 |
| 58 // Owning TabContentsWrapper. | 66 // Owning TabContentsWrapper. |
| 59 TabContentsWrapper* tab_contents_wrapper_; | 67 TabContentsWrapper* tab_contents_wrapper_; |
| 60 | 68 |
| 61 // Delegate for notifying our owner (usually Browser) about stuff. Not owned | 69 // Delegate for notifying our owner (usually Browser) about stuff. Not owned |
| 62 // by us. | 70 // by us. |
| 63 DownloadTabHelperDelegate* delegate_; | 71 DownloadTabHelperDelegate* delegate_; |
| 64 | 72 |
| 65 DISALLOW_COPY_AND_ASSIGN(DownloadTabHelper); | 73 DISALLOW_COPY_AND_ASSIGN(DownloadTabHelper); |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 #endif // CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ | 76 #endif // CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ |
| OLD | NEW |