Index: chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc |
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4e3263b385872a02a07b4fc7afa950cc7b2a8de3 |
--- /dev/null |
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_android.cc |
@@ -0,0 +1,72 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/geolocation/chrome_geolocation_permission_context_android.h" |
+ |
+#include "chrome/browser/geolocation/geolocation_infobar_queue_controller_android.h" |
+#include "chrome/browser/prefs/pref_service.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/common/pref_names.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+ChromeGeolocationPermissionContext* ChromeGeolocationPermissionContext::Create( |
+ Profile *profile) { |
bulach
2012/10/17 13:17:38
nit: s/Profile *p/Profile* p/
Ramya
2012/10/17 21:43:31
Done.
|
+ return new ChromeGeolocationPermissionContextAndroid(profile); |
+} |
+ |
+void ChromeGeolocationPermissionContext::RegisterUserPrefs( |
+ PrefService *user_prefs) { |
bulach
2012/10/17 13:17:38
nit: s/PrefService *u/PrefService* u/
Ramya
2012/10/17 21:43:31
Done.
|
+ user_prefs->RegisterBooleanPref(prefs::kGeolocationEnabled, |
+ true, |
+ PrefService::UNSYNCABLE_PREF); |
+} |
+ |
+ChromeGeolocationPermissionContextAndroid:: |
+ChromeGeolocationPermissionContextAndroid(Profile* profile) |
+ : ChromeGeolocationPermissionContext(profile) { |
+} |
+ |
+void ChromeGeolocationPermissionContextAndroid::DecidePermission( |
+ int render_process_id, |
+ int render_view_id, |
+ int bridge_id, |
+ const GURL& requesting_frame, |
+ const GURL& embedder, |
+ base::Callback<void(bool)> callback) { |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ |
+ // Check to see if the feature in its entirety has been disabled. |
+ // This must happen before other services (e.g. tabs, extensions) |
+ // get an opportunity to allow the geolocation request. |
+ if (!profile()->GetPrefs()->GetBoolean(prefs::kGeolocationEnabled)) { |
+ PermissionDecided(render_process_id, render_view_id, bridge_id, |
+ requesting_frame, embedder, callback, false); |
+ return; |
+ } |
+ |
+ ChromeGeolocationPermissionContext::DecidePermission( |
+ render_process_id, render_view_id, bridge_id, |
+ requesting_frame, embedder, callback); |
+} |
+ |
+void ChromeGeolocationPermissionContextAndroid::PermissionDecided( |
+ int render_process_id, |
+ int render_view_id, |
+ int bridge_id, |
+ const GURL& requesting_frame, |
+ const GURL& embedder, |
+ base::Callback<void(bool)> callback, |
+ bool allowed) { |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ ChromeGeolocationPermissionContextAndroid::PermissionDecided( |
bulach
2012/10/17 13:17:38
this seems recursive :) probably remove 53-65 alto
Ramya
2012/10/17 21:43:31
Done.
|
+ render_process_id, render_view_id, bridge_id, |
+ requesting_frame, embedder, callback, true); |
+} |
+ |
+GeolocationInfoBarQueueController* |
+ChromeGeolocationPermissionContextAndroid::CreateQueueController() { |
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ return new GeolocationInfoBarQueueControllerAndroid( |
+ profile()); |
+} |