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

Unified Diff: android_webview/native/aw_contents.cc

Issue 11763002: Implementing native chromium GeolocationPermissionContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Different static cast Created 7 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_geolocation_permission_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index fbdc7105404dc1332c40a633a462cb11fa2320a7..0f15a404b82c79ad3eaac2f9cb934702e66db82e 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -6,7 +6,9 @@
#include <sys/system_properties.h>
+#include "android_webview/browser/aw_browser_context.h"
#include "android_webview/browser/aw_browser_main_parts.h"
+#include "android_webview/browser/aw_content_browser_client.h"
#include "android_webview/browser/net_disk_cache_remover.h"
#include "android_webview/browser/renderer_host/aw_render_view_host_ext.h"
#include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h"
@@ -28,6 +30,7 @@
#include "cc/layer.h"
#include "content/components/navigation_interception/intercept_navigation_delegate.h"
#include "content/public/browser/android/content_view_core.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cert_store.h"
#include "content/public/browser/navigation_entry.h"
@@ -166,6 +169,16 @@ AwContents::AwContents(JNIEnv* env,
// factory method to java side and have that orchestrate the construction
// order.
SetWebContents(dependency_factory->CreateWebContents(private_browsing));
+
+ if (!web_contents_->GetBrowserContext()->GetGeolocationPermissionContext()) {
+ // TODO(kristianm): This is evil, look for another way out
+ AwBrowserContext* aw_browser_context =
+ static_cast<AwContentBrowserClient*>(
+ content::GetContentClient()->browser())->GetAwBrowserContext();
+ if (aw_browser_context)
+ aw_browser_context->set_geolocation_permissions_context(
boliu 2013/01/03 08:14:38 BrowserContext outlives AwContents, it's equivalen
Kristian Monsen 2013/01/03 08:37:58 I just need some place in native/ to construct thi
boliu 2013/01/03 08:48:35 AwMainDelegate is in lib/ which can include native
Kristian Monsen 2013/01/04 06:14:21 Passed it in the ctor to AwContentBrowserClient.
+ new AwGeolocationPermissionContext());
+ }
}
void AwContents::ResetCompositor() {
@@ -647,6 +660,21 @@ bool RegisterAwContents(JNIEnv* env) {
return RegisterNativesImpl(env) >= 0;
}
+void AwContents::GeolocationShowPrompt(int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jstring> j_requesting_frame(
+ ConvertUTF8ToJavaString(env, requesting_frame.spec()));
+ Java_AwContents_onGeolocationPermissionsShowPrompt(env,
+ java_ref_.get(env).obj(), render_process_id, render_view_id, bridge_id,
+ j_requesting_frame.obj());
+}
+
+void AwContents::GeolocationHidePrompt() {
+}
+
jint AwContents::FindAllSync(JNIEnv* env, jobject obj, jstring search_string) {
return GetFindHelper()->FindAllSync(
ConvertJavaStringToUTF16(env, search_string));
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | android_webview/native/aw_geolocation_permission_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698