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

Side by Side Diff: android_webview/native/aw_contents.h

Issue 268543005: Revert of Handle media access permission request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
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 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ 5 #ifndef ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_
6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ 6 #define ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "android_webview/browser/browser_view_renderer.h" 13 #include "android_webview/browser/browser_view_renderer.h"
14 #include "android_webview/browser/browser_view_renderer_client.h" 14 #include "android_webview/browser/browser_view_renderer_client.h"
15 #include "android_webview/browser/find_helper.h" 15 #include "android_webview/browser/find_helper.h"
16 #include "android_webview/browser/icon_helper.h" 16 #include "android_webview/browser/icon_helper.h"
17 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" 17 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h"
18 #include "android_webview/browser/shared_renderer_state.h" 18 #include "android_webview/browser/shared_renderer_state.h"
19 #include "android_webview/native/permission/permission_request_handler_client.h"
20 #include "base/android/jni_weak_ref.h" 19 #include "base/android/jni_weak_ref.h"
21 #include "base/android/scoped_java_ref.h" 20 #include "base/android/scoped_java_ref.h"
22 #include "base/callback_forward.h" 21 #include "base/callback_forward.h"
23 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
24 23
25 class SkBitmap; 24 class SkBitmap;
26 class TabContents; 25 class TabContents;
27 struct AwDrawGLInfo; 26 struct AwDrawGLInfo;
28 27
29 namespace content { 28 namespace content {
30 class WebContents; 29 class WebContents;
31 } 30 }
32 31
33 namespace android_webview { 32 namespace android_webview {
34 33
35 class AwContentsContainer; 34 class AwContentsContainer;
36 class AwContentsClientBridge; 35 class AwContentsClientBridge;
37 class AwPdfExporter; 36 class AwPdfExporter;
38 class AwWebContentsDelegate; 37 class AwWebContentsDelegate;
39 class HardwareRenderer; 38 class HardwareRenderer;
40 class PermissionRequestHandler;
41 39
42 // Native side of java-class of same name. 40 // Native side of java-class of same name.
43 // Provides the ownership of and access to browser components required for 41 // Provides the ownership of and access to browser components required for
44 // WebView functionality; analogous to chrome's TabContents, but with a 42 // WebView functionality; analogous to chrome's TabContents, but with a
45 // level of indirection provided by the AwContentsContainer abstraction. 43 // level of indirection provided by the AwContentsContainer abstraction.
46 // 44 //
47 // Object lifetime: 45 // Object lifetime:
48 // For most purposes the java and native objects can be considered to have 46 // For most purposes the java and native objects can be considered to have
49 // 1:1 lifetime and relationship. The exception is the java instance that 47 // 1:1 lifetime and relationship. The exception is the java instance that
50 // hosts a popup will be rebound to a second native instance (carrying the 48 // hosts a popup will be rebound to a second native instance (carrying the
51 // popup content) and discard the 'default' native instance it made on 49 // popup content) and discard the 'default' native instance it made on
52 // construction. A native instance is only bound to at most one Java peer over 50 // construction. A native instance is only bound to at most one Java peer over
53 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the 51 // its entire lifetime - see Init() and SetPendingWebContentsForPopup() for the
54 // construction points, and SetJavaPeers() where these paths join. 52 // construction points, and SetJavaPeers() where these paths join.
55 class AwContents : public FindHelper::Listener, 53 class AwContents : public FindHelper::Listener,
56 public IconHelper::Listener, 54 public IconHelper::Listener,
57 public AwRenderViewHostExtClient, 55 public AwRenderViewHostExtClient,
58 public BrowserViewRendererClient, 56 public BrowserViewRendererClient {
59 public PermissionRequestHandlerClient {
60 public: 57 public:
61 // Returns the AwContents instance associated with |web_contents|, or NULL. 58 // Returns the AwContents instance associated with |web_contents|, or NULL.
62 static AwContents* FromWebContents(content::WebContents* web_contents); 59 static AwContents* FromWebContents(content::WebContents* web_contents);
63 60
64 // Returns the AwContents instance associated with with the given 61 // Returns the AwContents instance associated with with the given
65 // render_process_id and render_view_id, or NULL. 62 // render_process_id and render_view_id, or NULL.
66 static AwContents* FromID(int render_process_id, int render_view_id); 63 static AwContents* FromID(int render_process_id, int render_view_id);
67 64
68 AwContents(scoped_ptr<content::WebContents> web_contents); 65 AwContents(scoped_ptr<content::WebContents> web_contents);
69 virtual ~AwContents(); 66 virtual ~AwContents();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void ClearClientCertPreferences(JNIEnv* env, jobject obj); 133 void ClearClientCertPreferences(JNIEnv* env, jobject obj);
137 134
138 // Geolocation API support 135 // Geolocation API support
139 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>); 136 void ShowGeolocationPrompt(const GURL& origin, base::Callback<void(bool)>);
140 void HideGeolocationPrompt(const GURL& origin); 137 void HideGeolocationPrompt(const GURL& origin);
141 void InvokeGeolocationCallback(JNIEnv* env, 138 void InvokeGeolocationCallback(JNIEnv* env,
142 jobject obj, 139 jobject obj,
143 jboolean value, 140 jboolean value,
144 jstring origin); 141 jstring origin);
145 142
146 // PermissionRequestHandlerClient implementation.
147 virtual void OnPermissionRequest(AwPermissionRequest* request) OVERRIDE;
148 virtual void OnPermissionRequestCanceled(
149 AwPermissionRequest* request) OVERRIDE;
150
151 PermissionRequestHandler* GetPermissionRequestHandler() {
152 return permission_request_handler_.get();
153 }
154
155 // Find-in-page API and related methods. 143 // Find-in-page API and related methods.
156 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string); 144 void FindAllAsync(JNIEnv* env, jobject obj, jstring search_string);
157 void FindNext(JNIEnv* env, jobject obj, jboolean forward); 145 void FindNext(JNIEnv* env, jobject obj, jboolean forward);
158 void ClearMatches(JNIEnv* env, jobject obj); 146 void ClearMatches(JNIEnv* env, jobject obj);
159 FindHelper* GetFindHelper(); 147 FindHelper* GetFindHelper();
160 148
161 // FindHelper::Listener implementation. 149 // FindHelper::Listener implementation.
162 virtual void OnFindResultReceived(int active_ordinal, 150 virtual void OnFindResultReceived(int active_ordinal,
163 int match_count, 151 int match_count,
164 bool finished) OVERRIDE; 152 bool finished) OVERRIDE;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_; 215 scoped_ptr<AwWebContentsDelegate> web_contents_delegate_;
228 scoped_ptr<AwContentsClientBridge> contents_client_bridge_; 216 scoped_ptr<AwContentsClientBridge> contents_client_bridge_;
229 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_; 217 scoped_ptr<AwRenderViewHostExt> render_view_host_ext_;
230 scoped_ptr<FindHelper> find_helper_; 218 scoped_ptr<FindHelper> find_helper_;
231 scoped_ptr<IconHelper> icon_helper_; 219 scoped_ptr<IconHelper> icon_helper_;
232 scoped_ptr<AwContents> pending_contents_; 220 scoped_ptr<AwContents> pending_contents_;
233 SharedRendererState shared_renderer_state_; 221 SharedRendererState shared_renderer_state_;
234 BrowserViewRenderer browser_view_renderer_; 222 BrowserViewRenderer browser_view_renderer_;
235 scoped_ptr<HardwareRenderer> hardware_renderer_; 223 scoped_ptr<HardwareRenderer> hardware_renderer_;
236 scoped_ptr<AwPdfExporter> pdf_exporter_; 224 scoped_ptr<AwPdfExporter> pdf_exporter_;
237 scoped_ptr<PermissionRequestHandler> permission_request_handler_;
238 225
239 // GURL is supplied by the content layer as requesting frame. 226 // GURL is supplied by the content layer as requesting frame.
240 // Callback is supplied by the content layer, and is invoked with the result 227 // Callback is supplied by the content layer, and is invoked with the result
241 // from the permission prompt. 228 // from the permission prompt.
242 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback; 229 typedef std::pair<const GURL, base::Callback<void(bool)> > OriginCallback;
243 // The first element in the list is always the currently pending request. 230 // The first element in the list is always the currently pending request.
244 std::list<OriginCallback> pending_geolocation_prompts_; 231 std::list<OriginCallback> pending_geolocation_prompts_;
245 232
246 DISALLOW_COPY_AND_ASSIGN(AwContents); 233 DISALLOW_COPY_AND_ASSIGN(AwContents);
247 }; 234 };
248 235
249 bool RegisterAwContents(JNIEnv* env); 236 bool RegisterAwContents(JNIEnv* env);
250 237
251 } // namespace android_webview 238 } // namespace android_webview
252 239
253 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_ 240 #endif // ANDROID_WEBVIEW_NATIVE_AW_CONTENTS_H_
OLDNEW
« no previous file with comments | « android_webview/native/android_webview_jni_registrar.cc ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698