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 // This class pairs with DownloadController on Java side to forward requests | 5 // This class pairs with DownloadController on Java side to forward requests |
6 // for GET downloads to the current DownloadListener. POST downloads are | 6 // for GET downloads to the current DownloadListener. POST downloads are |
7 // handled on the native side. | 7 // handled on the native side. |
8 // | 8 // |
9 // Both classes are Singleton classes. C++ object owns Java object. | 9 // Both classes are Singleton classes. C++ object owns Java object. |
10 // | 10 // |
11 // Call sequence | 11 // Call sequence |
12 // GET downloads: | 12 // GET downloads: |
13 // DownloadController::NewGetDownload() => | 13 // DownloadController::NewGetDownload() => |
14 // DownloadController.newHttpGetDownload() => | 14 // DownloadController.newHttpGetDownload() => |
15 // DownloadListener.onDownloadStart() / | 15 // DownloadListener.onDownloadStart() / |
16 // DownloadListener2.requestHttpGetDownload() | 16 // DownloadListener2.requestHttpGetDownload() |
17 // | 17 // |
18 | 18 |
19 #ifndef CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_H_ | 19 #ifndef CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_H_ |
20 #define CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_H_ | 20 #define CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_H_ |
21 | 21 |
22 #include <string> | 22 #include <string> |
23 | 23 |
24 #include "base/android/jni_helper.h" | 24 #include "base/android/jni_helper.h" |
| 25 #include "base/android/scoped_java_ref.h" |
25 #include "base/memory/singleton.h" | 26 #include "base/memory/singleton.h" |
26 #include "content/public/browser/download_item.h" | 27 #include "content/public/browser/download_item.h" |
27 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" |
28 #include "net/cookies/cookie_monster.h" | 29 #include "net/cookies/cookie_monster.h" |
29 | 30 |
30 namespace net { | 31 namespace net { |
31 class URLRequest; | 32 class URLRequest; |
32 } | 33 } |
33 | 34 |
34 namespace content { | 35 namespace content { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 103 |
103 void OnCookieResponse(DownloadInfoAndroid info, | 104 void OnCookieResponse(DownloadInfoAndroid info, |
104 int render_process_id, | 105 int render_process_id, |
105 int render_view_id, | 106 int render_view_id, |
106 const std::string& cookie); | 107 const std::string& cookie); |
107 | 108 |
108 void StartAndroidDownload(const DownloadInfoAndroid& info, | 109 void StartAndroidDownload(const DownloadInfoAndroid& info, |
109 int render_process_id, | 110 int render_process_id, |
110 int render_view_id); | 111 int render_view_id); |
111 | 112 |
112 jobject GetContentViewCoreFromWebContents(WebContents* web_contents); | 113 base::android::ScopedJavaLocalRef<jobject> GetContentViewCoreFromWebContents( |
113 jobject GetContentView(int render_process_id, int render_view_id); | 114 WebContents* web_contents); |
| 115 |
| 116 base::android::ScopedJavaLocalRef<jobject> GetContentView( |
| 117 int render_process_id, int render_view_id); |
114 | 118 |
115 // Creates Java object if it is not created already and returns it. | 119 // Creates Java object if it is not created already and returns it. |
116 JavaObject* GetJavaObject(); | 120 JavaObject* GetJavaObject(); |
117 | 121 |
118 JavaObject* java_object_; | 122 JavaObject* java_object_; |
119 | 123 |
120 DISALLOW_COPY_AND_ASSIGN(DownloadController); | 124 DISALLOW_COPY_AND_ASSIGN(DownloadController); |
121 }; | 125 }; |
122 | 126 |
123 } // namespace content | 127 } // namespace content |
124 | 128 |
125 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_H_ | 129 #endif // CONTENT_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_H_ |
OLD | NEW |