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 #include "android_webview/native/aw_web_contents_delegate.h" | 5 #include "android_webview/native/aw_web_contents_delegate.h" |
6 | 6 |
7 #include "android_webview/browser/aw_javascript_dialog_manager.h" | 7 #include "android_webview/browser/aw_javascript_dialog_manager.h" |
8 #include "android_webview/browser/find_helper.h" | 8 #include "android_webview/browser/find_helper.h" |
9 #include "android_webview/native/aw_contents.h" | 9 #include "android_webview/native/aw_contents.h" |
10 #include "android_webview/native/aw_contents_io_thread_client_impl.h" | 10 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 const int kFileChooserModeOpenMultiple = 1 << 0; | 40 const int kFileChooserModeOpenMultiple = 1 << 0; |
41 const int kFileChooserModeOpenFolder = 1 << 1; | 41 const int kFileChooserModeOpenFolder = 1 << 1; |
42 | 42 |
43 base::LazyInstance<AwJavaScriptDialogManager>::Leaky | 43 base::LazyInstance<AwJavaScriptDialogManager>::Leaky |
44 g_javascript_dialog_manager = LAZY_INSTANCE_INITIALIZER; | 44 g_javascript_dialog_manager = LAZY_INSTANCE_INITIALIZER; |
45 } | 45 } |
46 | 46 |
47 AwWebContentsDelegate::AwWebContentsDelegate( | 47 AwWebContentsDelegate::AwWebContentsDelegate( |
48 JNIEnv* env, | 48 JNIEnv* env, |
49 jobject obj) | 49 jobject obj) |
50 : WebContentsDelegateAndroid(env, obj) { | 50 : WebContentsDelegateAndroid(env, obj), |
| 51 is_fullscreen_(false) { |
51 } | 52 } |
52 | 53 |
53 AwWebContentsDelegate::~AwWebContentsDelegate() { | 54 AwWebContentsDelegate::~AwWebContentsDelegate() { |
54 } | 55 } |
55 | 56 |
56 content::JavaScriptDialogManager* | 57 content::JavaScriptDialogManager* |
57 AwWebContentsDelegate::GetJavaScriptDialogManager() { | 58 AwWebContentsDelegate::GetJavaScriptDialogManager() { |
58 return g_javascript_dialog_manager.Pointer(); | 59 return g_javascript_dialog_manager.Pointer(); |
59 } | 60 } |
60 | 61 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 callback.Run(content::MediaStreamDevices(), | 201 callback.Run(content::MediaStreamDevices(), |
201 content::MEDIA_DEVICE_INVALID_STATE, | 202 content::MEDIA_DEVICE_INVALID_STATE, |
202 scoped_ptr<content::MediaStreamUI>().Pass()); | 203 scoped_ptr<content::MediaStreamUI>().Pass()); |
203 return; | 204 return; |
204 } | 205 } |
205 aw_contents->GetPermissionRequestHandler()->SendRequest( | 206 aw_contents->GetPermissionRequestHandler()->SendRequest( |
206 scoped_ptr<AwPermissionRequestDelegate>( | 207 scoped_ptr<AwPermissionRequestDelegate>( |
207 new MediaAccessPermissionRequest(request, callback))); | 208 new MediaAccessPermissionRequest(request, callback))); |
208 } | 209 } |
209 | 210 |
| 211 void AwWebContentsDelegate::ToggleFullscreenModeForTab( |
| 212 content::WebContents* web_contents, bool enter_fullscreen) { |
| 213 is_fullscreen_ = enter_fullscreen; |
| 214 web_contents->GetRenderViewHost()->FullscreenChanged(enter_fullscreen); |
| 215 } |
| 216 |
| 217 bool AwWebContentsDelegate::IsFullscreenForTabOrPending( |
| 218 const content::WebContents* web_contents) const { |
| 219 return is_fullscreen_; |
| 220 } |
| 221 |
| 222 |
210 static void FilesSelectedInChooser( | 223 static void FilesSelectedInChooser( |
211 JNIEnv* env, jclass clazz, | 224 JNIEnv* env, jclass clazz, |
212 jint process_id, jint render_id, jint mode_flags, | 225 jint process_id, jint render_id, jint mode_flags, |
213 jobjectArray file_paths) { | 226 jobjectArray file_paths) { |
214 content::RenderViewHost* rvh = content::RenderViewHost::FromID(process_id, | 227 content::RenderViewHost* rvh = content::RenderViewHost::FromID(process_id, |
215 render_id); | 228 render_id); |
216 if (!rvh) | 229 if (!rvh) |
217 return; | 230 return; |
218 | 231 |
219 std::vector<std::string> file_path_str; | 232 std::vector<std::string> file_path_str; |
(...skipping 20 matching lines...) Expand all Loading... |
240 DVLOG(0) << "File Chooser result: mode = " << mode | 253 DVLOG(0) << "File Chooser result: mode = " << mode |
241 << ", file paths = " << JoinString(file_path_str, ":"); | 254 << ", file paths = " << JoinString(file_path_str, ":"); |
242 rvh->FilesSelectedInChooser(files, mode); | 255 rvh->FilesSelectedInChooser(files, mode); |
243 } | 256 } |
244 | 257 |
245 bool RegisterAwWebContentsDelegate(JNIEnv* env) { | 258 bool RegisterAwWebContentsDelegate(JNIEnv* env) { |
246 return RegisterNativesImpl(env); | 259 return RegisterNativesImpl(env); |
247 } | 260 } |
248 | 261 |
249 } // namespace android_webview | 262 } // namespace android_webview |
OLD | NEW |