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

Unified Diff: chrome/browser/geolocation/chrome_geolocation_permission_context.h

Issue 11183018: Refactor ChromeGeolocationPermissionContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing unit tests Created 8 years, 2 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
Index: chrome/browser/geolocation/chrome_geolocation_permission_context.h
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.h b/chrome/browser/geolocation/chrome_geolocation_permission_context.h
index d0f35cee28235a3ea5a9c586051caddf5035a98e..48149c3c3053a15950506f2dc4947ca65cfabe2c 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context.h
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
#define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
+#include <string>
+
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/geolocation_permission_context.h"
@@ -18,7 +20,7 @@ class Profile;
class ChromeGeolocationPermissionContext
: public content::GeolocationPermissionContext {
public:
- explicit ChromeGeolocationPermissionContext(Profile* profile);
+ static ChromeGeolocationPermissionContext* Create(Profile *profile);
bulach 2012/10/17 12:59:33 nit: s/Profile *p/Profile* p/ however, I just cha
Ramya 2012/10/17 17:38:43 Agreed. Will make the change in the http://coderev
static void RegisterUserPrefs(PrefService *user_prefs);
@@ -35,17 +37,37 @@ class ChromeGeolocationPermissionContext
int bridge_id,
const GURL& requesting_frame) OVERRIDE;
- private:
+ protected:
+ explicit ChromeGeolocationPermissionContext(Profile* profile);
virtual ~ChromeGeolocationPermissionContext();
- // Removes any pending InfoBar request.
- void CancelPendingInfoBarRequest(int render_process_id,
- int render_view_id,
- int bridge_id);
+ // Decide whether the geolocation permission should be granted.
+ // Calls PermissionDecided if permission can be decided non-interactively,
+ // or NotifyPermissionSet if permission decided by presenting an
+ // infobar to the user. Called on the UI thread.
+ virtual void DecidePermission(int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ const GURL& embedder,
+ base::Callback<void(bool)> callback);
+
+ // Called when permission is granted without interactively asking
+ // the user. Can be overridden to introduce additional UI flow.
+ // Should ultimately ensure that NotifyPermissionSet is called.
+ // Called on the UI thread.
+ virtual void 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);
// Notifies whether or not the corresponding bridge is allowed to use
// geolocation via
// GeolocationPermissionContext::SetGeolocationPermissionResponse().
+ // Called on the UI thread.
void NotifyPermissionSet(int render_process_id,
int render_view_id,
int bridge_id,
@@ -53,6 +75,22 @@ class ChromeGeolocationPermissionContext
base::Callback<void(bool)> callback,
bool allowed);
+ // Return an instance of the infobar queue controller, creating it
+ // if necessary.
+ GeolocationInfoBarQueueController* QueueController();
+
+ // Create an InfoBarQueueController. overriden in derived classes to provide
+ // additional UI flow. Called on the UI thread.
+ virtual GeolocationInfoBarQueueController* CreateQueueController();
+
+ Profile* profile() const { return profile_; }
bulach 2012/10/17 12:59:33 nit: I think this method and QueueController() sho
Ramya 2012/10/17 17:38:43 Done.
+
+ private:
+ // Removes any pending InfoBar request.
+ void CancelPendingInfoBarRequest(int render_process_id,
+ int render_view_id,
+ int bridge_id);
+
// This must only be accessed from the UI thread.
Profile* const profile_;

Powered by Google App Engine
This is Rietveld 408576698