OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_quota_manager_bridge_impl.h" | 5 #include "android_webview/native/aw_quota_manager_bridge_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
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_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void GetOriginsTask::DoneOnUIThread() { | 139 void GetOriginsTask::DoneOnUIThread() { |
140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
141 ui_callback_.Run(origin_, usage_, quota_); | 141 ui_callback_.Run(origin_, usage_, quota_); |
142 } | 142 } |
143 | 143 |
144 } // namespace | 144 } // namespace |
145 | 145 |
146 | 146 |
147 // static | 147 // static |
148 jint GetDefaultNativeAwQuotaManagerBridge(JNIEnv* env, jclass clazz) { | 148 jint GetDefaultNativeAwQuotaManagerBridge(JNIEnv* env, jclass clazz) { |
149 content::ContentBrowserClient* browser_client = | 149 AwBrowserContext* browser_context = |
150 content::GetContentClient()->browser(); | 150 AwContentBrowserClient::GetAwBrowserContext(); |
151 DCHECK(browser_client); | |
152 | |
153 AwContentBrowserClient* aw_browser_client = | |
154 AwContentBrowserClient::FromContentBrowserClient(browser_client); | |
155 AwBrowserContext* browser_context = aw_browser_client->GetAwBrowserContext(); | |
156 DCHECK(browser_context); | |
157 | 151 |
158 AwQuotaManagerBridgeImpl* bridge = static_cast<AwQuotaManagerBridgeImpl*>( | 152 AwQuotaManagerBridgeImpl* bridge = static_cast<AwQuotaManagerBridgeImpl*>( |
159 browser_context->GetQuotaManagerBridge()); | 153 browser_context->GetQuotaManagerBridge()); |
160 DCHECK(bridge); | 154 DCHECK(bridge); |
161 return reinterpret_cast<jint>(bridge); | 155 return reinterpret_cast<jint>(bridge); |
162 } | 156 } |
163 | 157 |
164 AwQuotaManagerBridgeImpl::AwQuotaManagerBridgeImpl( | 158 AwQuotaManagerBridgeImpl::AwQuotaManagerBridgeImpl( |
165 AwBrowserContext* browser_context) | 159 AwBrowserContext* browser_context) |
166 : weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 160 : weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 289 |
296 Java_AwQuotaManagerBridge_onGetUsageAndQuotaForOriginCallback( | 290 Java_AwQuotaManagerBridge_onGetUsageAndQuotaForOriginCallback( |
297 env, obj.obj(), jcallback_id, is_quota, usage, quota); | 291 env, obj.obj(), jcallback_id, is_quota, usage, quota); |
298 } | 292 } |
299 | 293 |
300 bool RegisterAwQuotaManagerBridge(JNIEnv* env) { | 294 bool RegisterAwQuotaManagerBridge(JNIEnv* env) { |
301 return RegisterNativesImpl(env) >= 0; | 295 return RegisterNativesImpl(env) >= 0; |
302 } | 296 } |
303 | 297 |
304 } // namespace android_webview | 298 } // namespace android_webview |
OLD | NEW |