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

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

Issue 306053008: Rename AutofillManagerDelegate to AutofillClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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 | « android_webview/native/aw_contents.h ('k') | android_webview/native/webview_native.gyp » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
11 #include "android_webview/browser/aw_resource_context.h" 11 #include "android_webview/browser/aw_resource_context.h"
12 #include "android_webview/browser/browser_view_renderer.h" 12 #include "android_webview/browser/browser_view_renderer.h"
13 #include "android_webview/browser/deferred_gpu_command_service.h" 13 #include "android_webview/browser/deferred_gpu_command_service.h"
14 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h" 14 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h"
15 #include "android_webview/browser/hardware_renderer.h" 15 #include "android_webview/browser/hardware_renderer.h"
16 #include "android_webview/browser/hardware_renderer_legacy.h" 16 #include "android_webview/browser/hardware_renderer_legacy.h"
17 #include "android_webview/browser/net_disk_cache_remover.h" 17 #include "android_webview/browser/net_disk_cache_remover.h"
18 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h" 18 #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_dele gate.h"
19 #include "android_webview/browser/scoped_app_gl_state_restore.h" 19 #include "android_webview/browser/scoped_app_gl_state_restore.h"
20 #include "android_webview/common/aw_hit_test_data.h" 20 #include "android_webview/common/aw_hit_test_data.h"
21 #include "android_webview/common/aw_switches.h" 21 #include "android_webview/common/aw_switches.h"
22 #include "android_webview/common/devtools_instrumentation.h" 22 #include "android_webview/common/devtools_instrumentation.h"
23 #include "android_webview/native/aw_autofill_manager_delegate.h" 23 #include "android_webview/native/aw_autofill_client.h"
24 #include "android_webview/native/aw_browser_dependency_factory.h" 24 #include "android_webview/native/aw_browser_dependency_factory.h"
25 #include "android_webview/native/aw_contents_client_bridge.h" 25 #include "android_webview/native/aw_contents_client_bridge.h"
26 #include "android_webview/native/aw_contents_io_thread_client_impl.h" 26 #include "android_webview/native/aw_contents_io_thread_client_impl.h"
27 #include "android_webview/native/aw_pdf_exporter.h" 27 #include "android_webview/native/aw_pdf_exporter.h"
28 #include "android_webview/native/aw_picture.h" 28 #include "android_webview/native/aw_picture.h"
29 #include "android_webview/native/aw_web_contents_delegate.h" 29 #include "android_webview/native/aw_web_contents_delegate.h"
30 #include "android_webview/native/java_browser_view_renderer_helper.h" 30 #include "android_webview/native/java_browser_view_renderer_helper.h"
31 #include "android_webview/native/permission/aw_permission_request.h" 31 #include "android_webview/native/permission/aw_permission_request.h"
32 #include "android_webview/native/permission/permission_request_handler.h" 32 #include "android_webview/native/permission/permission_request_handler.h"
33 #include "android_webview/native/state_serializer.h" 33 #include "android_webview/native/state_serializer.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 icon_helper_.reset(new IconHelper(web_contents_.get())); 167 icon_helper_.reset(new IconHelper(web_contents_.get()));
168 icon_helper_->SetListener(this); 168 icon_helper_->SetListener(this);
169 web_contents_->SetUserData(kAwContentsUserDataKey, 169 web_contents_->SetUserData(kAwContentsUserDataKey,
170 new AwContentsUserData(this)); 170 new AwContentsUserData(this));
171 render_view_host_ext_.reset( 171 render_view_host_ext_.reset(
172 new AwRenderViewHostExt(this, web_contents_.get())); 172 new AwRenderViewHostExt(this, web_contents_.get()));
173 173
174 permission_request_handler_.reset( 174 permission_request_handler_.reset(
175 new PermissionRequestHandler(this, web_contents_.get())); 175 new PermissionRequestHandler(this, web_contents_.get()));
176 176
177 AwAutofillManagerDelegate* autofill_manager_delegate = 177 AwAutofillClient* autofill_manager_delegate =
178 AwAutofillManagerDelegate::FromWebContents(web_contents_.get()); 178 AwAutofillClient::FromWebContents(web_contents_.get());
179 InitDataReductionProxyIfNecessary(); 179 InitDataReductionProxyIfNecessary();
180 if (autofill_manager_delegate) 180 if (autofill_manager_delegate)
181 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData()); 181 InitAutofillIfNecessary(autofill_manager_delegate->GetSaveFormData());
182 } 182 }
183 183
184 void AwContents::SetJavaPeers(JNIEnv* env, 184 void AwContents::SetJavaPeers(JNIEnv* env,
185 jobject obj, 185 jobject obj,
186 jobject aw_contents, 186 jobject aw_contents,
187 jobject web_contents_delegate, 187 jobject web_contents_delegate,
188 jobject contents_client_bridge, 188 jobject contents_client_bridge,
(...skipping 24 matching lines...) Expand all
213 // Finally, having setup the associations, release any deferred requests 213 // Finally, having setup the associations, release any deferred requests
214 web_contents_->ForEachFrame(base::Bind(&OnIoThreadClientReady)); 214 web_contents_->ForEachFrame(base::Bind(&OnIoThreadClientReady));
215 } 215 }
216 216
217 void AwContents::SetSaveFormData(bool enabled) { 217 void AwContents::SetSaveFormData(bool enabled) {
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
219 InitAutofillIfNecessary(enabled); 219 InitAutofillIfNecessary(enabled);
220 // We need to check for the existence, since autofill_manager_delegate 220 // We need to check for the existence, since autofill_manager_delegate
221 // may not be created when the setting is false. 221 // may not be created when the setting is false.
222 if (ContentAutofillDriver::FromWebContents(web_contents_.get())) { 222 if (ContentAutofillDriver::FromWebContents(web_contents_.get())) {
223 AwAutofillManagerDelegate::FromWebContents(web_contents_.get())-> 223 AwAutofillClient::FromWebContents(web_contents_.get())->
224 SetSaveFormData(enabled); 224 SetSaveFormData(enabled);
225 } 225 }
226 } 226 }
227 227
228 void AwContents::InitDataReductionProxyIfNecessary() { 228 void AwContents::InitDataReductionProxyIfNecessary() {
229 AwBrowserContext* browser_context = 229 AwBrowserContext* browser_context =
230 AwBrowserContext::FromWebContents(web_contents_.get()); 230 AwBrowserContext::FromWebContents(web_contents_.get());
231 browser_context->CreateUserPrefServiceIfNecessary(); 231 browser_context->CreateUserPrefServiceIfNecessary();
232 } 232 }
233 233
234 void AwContents::InitAutofillIfNecessary(bool enabled) { 234 void AwContents::InitAutofillIfNecessary(bool enabled) {
235 // Do not initialize if the feature is not enabled. 235 // Do not initialize if the feature is not enabled.
236 if (!enabled) 236 if (!enabled)
237 return; 237 return;
238 // Check if the autofill driver already exists. 238 // Check if the autofill driver already exists.
239 content::WebContents* web_contents = web_contents_.get(); 239 content::WebContents* web_contents = web_contents_.get();
240 if (ContentAutofillDriver::FromWebContents(web_contents)) 240 if (ContentAutofillDriver::FromWebContents(web_contents))
241 return; 241 return;
242 242
243 AwBrowserContext::FromWebContents(web_contents)-> 243 AwBrowserContext::FromWebContents(web_contents)->
244 CreateUserPrefServiceIfNecessary(); 244 CreateUserPrefServiceIfNecessary();
245 AwAutofillManagerDelegate::CreateForWebContents(web_contents); 245 AwAutofillClient::CreateForWebContents(web_contents);
246 ContentAutofillDriver::CreateForWebContentsAndDelegate( 246 ContentAutofillDriver::CreateForWebContentsAndDelegate(
247 web_contents, 247 web_contents,
248 AwAutofillManagerDelegate::FromWebContents(web_contents), 248 AwAutofillClient::FromWebContents(web_contents),
249 l10n_util::GetDefaultLocale(), 249 l10n_util::GetDefaultLocale(),
250 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); 250 AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
251 } 251 }
252 252
253 void AwContents::SetAwAutofillManagerDelegate(jobject delegate) { 253 void AwContents::SetAwAutofillClient(jobject client) {
254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
255 JNIEnv* env = AttachCurrentThread(); 255 JNIEnv* env = AttachCurrentThread();
256 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 256 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
257 if (obj.is_null()) 257 if (obj.is_null())
258 return; 258 return;
259 Java_AwContents_setAwAutofillManagerDelegate(env, obj.obj(), delegate); 259 Java_AwContents_setAwAutofillClient(env, obj.obj(), client);
260 } 260 }
261 261
262 AwContents::~AwContents() { 262 AwContents::~AwContents() {
263 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); 263 DCHECK(AwContents::FromWebContents(web_contents_.get()) == this);
264 DCHECK(!hardware_renderer_.get()); 264 DCHECK(!hardware_renderer_.get());
265 web_contents_->RemoveUserData(kAwContentsUserDataKey); 265 web_contents_->RemoveUserData(kAwContentsUserDataKey);
266 if (find_helper_.get()) 266 if (find_helper_.get())
267 find_helper_->SetListener(NULL); 267 find_helper_->SetListener(NULL);
268 if (icon_helper_.get()) 268 if (icon_helper_.get())
269 icon_helper_->SetListener(NULL); 269 icon_helper_->SetListener(NULL);
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 return; 1095 return;
1096 1096
1097 browser_view_renderer_.TrimMemory(level, visible); 1097 browser_view_renderer_.TrimMemory(level, visible);
1098 } 1098 }
1099 1099
1100 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1100 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1101 g_should_download_favicons = true; 1101 g_should_download_favicons = true;
1102 } 1102 }
1103 1103
1104 } // namespace android_webview 1104 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698