| OLD | NEW |
| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "android_webview/browser/aw_browser_context.h" | 10 #include "android_webview/browser/aw_browser_context.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 web_contents->GetUserData(kAwContentsUserDataKey)); | 130 web_contents->GetUserData(kAwContentsUserDataKey)); |
| 131 return data ? data->contents_ : NULL; | 131 return data ? data->contents_ : NULL; |
| 132 } | 132 } |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 AwContents* contents_; | 135 AwContents* contents_; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 base::subtle::Atomic32 g_instance_count = 0; | 138 base::subtle::Atomic32 g_instance_count = 0; |
| 139 | 139 |
| 140 void OnIoThreadClientReady(content::RenderFrameHost* rfh) { | |
| 141 int render_process_id = rfh->GetProcess()->GetID(); | |
| 142 int render_frame_id = rfh->GetRoutingID(); | |
| 143 AwResourceDispatcherHostDelegate::OnIoThreadClientReady( | |
| 144 render_process_id, render_frame_id); | |
| 145 } | |
| 146 | |
| 147 } // namespace | 140 } // namespace |
| 148 | 141 |
| 149 // static | 142 // static |
| 150 AwContents* AwContents::FromWebContents(WebContents* web_contents) { | 143 AwContents* AwContents::FromWebContents(WebContents* web_contents) { |
| 151 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 144 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 152 return AwContentsUserData::GetContents(web_contents); | 145 return AwContentsUserData::GetContents(web_contents); |
| 153 } | 146 } |
| 154 | 147 |
| 155 // static | 148 // static |
| 156 AwContents* AwContents::FromID(int render_process_id, int render_view_id) { | 149 AwContents* AwContents::FromID(int render_process_id, int render_view_id) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 231 |
| 239 AwContentsIoThreadClientImpl::Associate(web_contents_.get(), | 232 AwContentsIoThreadClientImpl::Associate(web_contents_.get(), |
| 240 io_thread_client); | 233 io_thread_client); |
| 241 | 234 |
| 242 InterceptNavigationDelegate::Associate( | 235 InterceptNavigationDelegate::Associate( |
| 243 web_contents_.get(), | 236 web_contents_.get(), |
| 244 make_scoped_ptr(new InterceptNavigationDelegate( | 237 make_scoped_ptr(new InterceptNavigationDelegate( |
| 245 env, intercept_navigation_delegate))); | 238 env, intercept_navigation_delegate))); |
| 246 | 239 |
| 247 // Finally, having setup the associations, release any deferred requests | 240 // Finally, having setup the associations, release any deferred requests |
| 248 web_contents_->ForEachFrame(base::Bind(&OnIoThreadClientReady)); | 241 for (content::RenderFrameHost* rfh : web_contents_->GetAllFrames()) { |
| 242 int render_process_id = rfh->GetProcess()->GetID(); |
| 243 int render_frame_id = rfh->GetRoutingID(); |
| 244 AwResourceDispatcherHostDelegate::OnIoThreadClientReady(render_process_id, |
| 245 render_frame_id); |
| 246 } |
| 249 } | 247 } |
| 250 | 248 |
| 251 void AwContents::SetSaveFormData(bool enabled) { | 249 void AwContents::SetSaveFormData(bool enabled) { |
| 252 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 250 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 253 InitAutofillIfNecessary(enabled); | 251 InitAutofillIfNecessary(enabled); |
| 254 // We need to check for the existence, since autofill_manager_delegate | 252 // We need to check for the existence, since autofill_manager_delegate |
| 255 // may not be created when the setting is false. | 253 // may not be created when the setting is false. |
| 256 if (AwAutofillClient::FromWebContents(web_contents_.get())) { | 254 if (AwAutofillClient::FromWebContents(web_contents_.get())) { |
| 257 AwAutofillClient::FromWebContents(web_contents_.get())-> | 255 AwAutofillClient::FromWebContents(web_contents_.get())-> |
| 258 SetSaveFormData(enabled); | 256 SetSaveFormData(enabled); |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 const JavaParamRef<jobject>& obj) { | 1276 const JavaParamRef<jobject>& obj) { |
| 1279 web_contents_->ResumeLoadingCreatedWebContents(); | 1277 web_contents_->ResumeLoadingCreatedWebContents(); |
| 1280 } | 1278 } |
| 1281 | 1279 |
| 1282 void SetShouldDownloadFavicons(JNIEnv* env, | 1280 void SetShouldDownloadFavicons(JNIEnv* env, |
| 1283 const JavaParamRef<jclass>& jclazz) { | 1281 const JavaParamRef<jclass>& jclazz) { |
| 1284 g_should_download_favicons = true; | 1282 g_should_download_favicons = true; |
| 1285 } | 1283 } |
| 1286 | 1284 |
| 1287 } // namespace android_webview | 1285 } // namespace android_webview |
| OLD | NEW |