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

Side by Side Diff: chrome/browser/plugin_download_helper.h

Issue 8373021: Convert URLFetcher::Delegates to use an interface in content/public/common. Also remove the old U... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync and remove unncessary forward declares Created 9 years, 2 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
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_PLUGIN_DOWNLOAD_HELPER_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_DOWNLOAD_HELPER_H_
6 #define CHROME_BROWSER_PLUGIN_DOWNLOAD_HELPER_H_ 6 #define CHROME_BROWSER_PLUGIN_DOWNLOAD_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 11
12 #if defined(OS_WIN) 12 #if defined(OS_WIN)
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "content/common/net/url_fetcher.h" 15 #include "content/public/common/url_fetcher_delegate.h"
16 #include "net/base/file_stream.h" 16 #include "net/base/file_stream.h"
17 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
18 #include "ui/gfx/native_widget_types.h" 18 #include "ui/gfx/native_widget_types.h"
19 19
20 namespace net {
21 class URLRequestContextGetter;
22 }
23
20 // The PluginDownloadUrlHelper is used to handle one download URL request 24 // The PluginDownloadUrlHelper is used to handle one download URL request
21 // from the plugin. Each download request is handled by a new instance 25 // from the plugin. Each download request is handled by a new instance
22 // of this class. 26 // of this class.
23 class PluginDownloadUrlHelper : public URLFetcher::Delegate { 27 class PluginDownloadUrlHelper : public content::URLFetcherDelegate {
24 public: 28 public:
25 // The delegate receives notification about the status of downloads 29 // The delegate receives notification about the status of downloads
26 // initiated. 30 // initiated.
27 class DownloadDelegate { 31 class DownloadDelegate {
28 public: 32 public:
29 virtual ~DownloadDelegate() {} 33 virtual ~DownloadDelegate() {}
30 34
31 virtual void OnDownloadCompleted(const FilePath& download_path, 35 virtual void OnDownloadCompleted(const FilePath& download_path,
32 bool success) {} 36 bool success) {}
33 }; 37 };
34 38
35 PluginDownloadUrlHelper(const std::string& download_url, 39 PluginDownloadUrlHelper(const std::string& download_url,
36 gfx::NativeWindow caller_window, 40 gfx::NativeWindow caller_window,
37 PluginDownloadUrlHelper::DownloadDelegate* delegate); 41 PluginDownloadUrlHelper::DownloadDelegate* delegate);
38 ~PluginDownloadUrlHelper(); 42 ~PluginDownloadUrlHelper();
39 43
40 void InitiateDownload(net::URLRequestContextGetter* request_context, 44 void InitiateDownload(net::URLRequestContextGetter* request_context,
41 base::MessageLoopProxy* file_thread_proxy); 45 base::MessageLoopProxy* file_thread_proxy);
42 46
43 // URLFetcher::Delegate 47 // content::URLFetcherDelegate
44 virtual void OnURLFetchComplete(const URLFetcher* source,
45 const GURL& url,
46 const net::URLRequestStatus& status,
47 int response_code,
48 const net::ResponseCookies& cookies,
49 const std::string& data) {}
50 virtual void OnURLFetchComplete(const URLFetcher* source); 48 virtual void OnURLFetchComplete(const URLFetcher* source);
51 49
52 void OnDownloadCompleted(net::URLRequest* request); 50 void OnDownloadCompleted(net::URLRequest* request);
53 51
54 protected: 52 protected:
55 // The download file request initiated by the plugin. 53 // The download file request initiated by the plugin.
56 scoped_ptr<URLFetcher> download_file_fetcher_; 54 scoped_ptr<URLFetcher> download_file_fetcher_;
57 // TODO(port): this comment doesn't describe the situation on Posix. 55 // TODO(port): this comment doesn't describe the situation on Posix.
58 // The window handle for sending the WM_COPYDATA notification, 56 // The window handle for sending the WM_COPYDATA notification,
59 // indicating that the download completed. 57 // indicating that the download completed.
60 gfx::NativeWindow download_file_caller_window_; 58 gfx::NativeWindow download_file_caller_window_;
61 59
62 std::string download_url_; 60 std::string download_url_;
63 61
64 PluginDownloadUrlHelper::DownloadDelegate* delegate_; 62 PluginDownloadUrlHelper::DownloadDelegate* delegate_;
65 63
66 DISALLOW_COPY_AND_ASSIGN(PluginDownloadUrlHelper); 64 DISALLOW_COPY_AND_ASSIGN(PluginDownloadUrlHelper);
67 }; 65 };
68 66
69 #endif // OS_WIN 67 #endif // OS_WIN
70 68
71 #endif // CHROME_BROWSER_PLUGIN_DOWNLOAD_HELPER_H_ 69 #endif // CHROME_BROWSER_PLUGIN_DOWNLOAD_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698