Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/ui/download/download_tab_helper.h

Issue 7035015: Revert 85504 - Move download stuff to download tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/download/download_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "content/browser/tab_contents/tab_contents_observer.h" 11 #include "content/browser/tab_contents/tab_contents_observer.h"
12 12
13 class DownloadItem;
14 class DownloadTabHelperDelegate;
15 class TabContentsWrapper; 13 class TabContentsWrapper;
16 14
17 // Per-tab download controller. Handles dealing with various per-tab download 15 // Per-tab download controller. Handles dealing with various per-tab download
18 // duties. 16 // duties.
19 class DownloadTabHelper : public TabContentsObserver { 17 class DownloadTabHelper : public TabContentsObserver {
20 public: 18 public:
21 explicit DownloadTabHelper(TabContentsWrapper* tab_contents); 19 explicit DownloadTabHelper(TabContentsWrapper* tab_contents);
22 virtual ~DownloadTabHelper(); 20 virtual ~DownloadTabHelper();
23 21
24 DownloadTabHelperDelegate* delegate() const { return delegate_; }
25 void set_delegate(DownloadTabHelperDelegate* d) { delegate_ = d; }
26
27 // Prepare for saving the current web page to disk. 22 // Prepare for saving the current web page to disk.
28 void OnSavePage(); 23 void OnSavePage();
29 24
30 // Prepare for saving the URL to disk. 25 // Prepare for saving the URL to disk.
31 // URL may refer to the iframe on the page. 26 // URL may refer to the iframe on the page.
32 void OnSaveURL(const GURL& url); 27 void OnSaveURL(const GURL& url);
33 28
34 // Save page with the main HTML file path, the directory for saving resources, 29 // 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 30 // and the save type: HTML only or complete web page. Returns true if the
36 // saving process has been initiated successfully. 31 // saving process has been initiated successfully.
37 bool SavePage(const FilePath& main_file, const FilePath& dir_path, 32 bool SavePage(const FilePath& main_file, const FilePath& dir_path,
38 SavePackage::SavePackageType save_type); 33 SavePackage::SavePackageType save_type);
39 34
40 // Returns the SavePackage which manages the page saving job. May be NULL. 35 // Returns the SavePackage which manages the page saving job. May be NULL.
41 SavePackage* save_package() const { return save_package_.get(); } 36 SavePackage* save_package() const { return save_package_.get(); }
42 37
43 // Notifies the delegate that a download is about to be started.
44 // This notification is fired before a local temporary file has been created.
45 bool CanDownload(int request_id);
46
47 // Notifies the delegate that a download started.
48 void OnStartDownload(DownloadItem* download);
49
50 private: 38 private:
51 // TabContentsObserver overrides. 39 // TabContentsObserver overrides.
52 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
53 virtual void DidGetUserGesture() OVERRIDE;
54 41
55 // SavePackage, lazily created. 42 // SavePackage, lazily created.
56 scoped_refptr<SavePackage> save_package_; 43 scoped_refptr<SavePackage> save_package_;
57 44
58 // Owning TabContentsWrapper. 45 // Owning TabContentsWrapper.
59 TabContentsWrapper* tab_contents_wrapper_; 46 TabContentsWrapper* tab_contents_wrapper_;
60 47
61 // Delegate for notifying our owner (usually Browser) about stuff. Not owned
62 // by us.
63 DownloadTabHelperDelegate* delegate_;
64
65 DISALLOW_COPY_AND_ASSIGN(DownloadTabHelper); 48 DISALLOW_COPY_AND_ASSIGN(DownloadTabHelper);
66 }; 49 };
67 50
68 #endif // CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_ 51 #endif // CHROME_BROWSER_UI_DOWNLOAD_DOWNLOAD_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/download/download_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698