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

Side by Side Diff: content/renderer/geolocation_dispatcher.h

Issue 722153003: Implement basic mojo Permission service and use it for Geolocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « content/content_common_mojo_bindings.gypi ('k') | content/renderer/geolocation_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_
6 #define CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ 6 #define CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/geolocation_service.mojom.h" 9 #include "content/common/geolocation_service.mojom.h"
10 #include "content/common/permission_service.mojom.h"
10 #include "content/public/renderer/render_frame_observer.h" 11 #include "content/public/renderer/render_frame_observer.h"
11 #include "third_party/WebKit/public/web/WebGeolocationClient.h" 12 #include "third_party/WebKit/public/web/WebGeolocationClient.h"
12 #include "third_party/WebKit/public/web/WebGeolocationController.h" 13 #include "third_party/WebKit/public/web/WebGeolocationController.h"
13 14
14 namespace blink { 15 namespace blink {
15 class WebGeolocationController; 16 class WebGeolocationController;
16 class WebGeolocationPermissionRequest; 17 class WebGeolocationPermissionRequest;
17 class WebGeolocationPermissionRequestManager; 18 class WebGeolocationPermissionRequestManager;
18 class WebGeolocationPosition; 19 class WebGeolocationPosition;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 struct Geoposition; 23 struct Geoposition;
23 24
24 // GeolocationDispatcher is a delegate for Geolocation messages used by 25 // GeolocationDispatcher is a delegate for Geolocation messages used by
25 // WebKit. 26 // WebKit.
26 // It's the complement of GeolocationDispatcherHost. 27 // It's the complement of GeolocationDispatcherHost.
27 class GeolocationDispatcher 28 class GeolocationDispatcher
28 : public RenderFrameObserver, 29 : public RenderFrameObserver,
29 public blink::WebGeolocationClient, 30 public blink::WebGeolocationClient,
30 public mojo::InterfaceImpl<GeolocationServiceClient> { 31 public mojo::InterfaceImpl<GeolocationServiceClient> {
31 public: 32 public:
32 explicit GeolocationDispatcher(RenderFrame* render_frame); 33 explicit GeolocationDispatcher(RenderFrame* render_frame);
33 virtual ~GeolocationDispatcher(); 34 virtual ~GeolocationDispatcher();
34 35
35 private: 36 private:
36 // RenderFrame::Observer implementation.
37 bool OnMessageReceived(const IPC::Message& message) override;
38
39 // WebGeolocationClient 37 // WebGeolocationClient
40 virtual void startUpdating(); 38 virtual void startUpdating();
41 virtual void stopUpdating(); 39 virtual void stopUpdating();
42 virtual void setEnableHighAccuracy(bool enable_high_accuracy); 40 virtual void setEnableHighAccuracy(bool enable_high_accuracy);
43 virtual void setController(blink::WebGeolocationController* controller); 41 virtual void setController(blink::WebGeolocationController* controller);
44 virtual bool lastPosition(blink::WebGeolocationPosition& position); 42 virtual bool lastPosition(blink::WebGeolocationPosition& position);
45 virtual void requestPermission( 43 virtual void requestPermission(
46 const blink::WebGeolocationPermissionRequest& permissionRequest); 44 const blink::WebGeolocationPermissionRequest& permissionRequest);
47 virtual void cancelPermissionRequest( 45 virtual void cancelPermissionRequest(
48 const blink::WebGeolocationPermissionRequest& permissionRequest); 46 const blink::WebGeolocationPermissionRequest& permissionRequest);
49 47
50 // GeolocationServiceClient 48 // GeolocationServiceClient
51 void OnLocationUpdate(MojoGeopositionPtr geoposition) override; 49 void OnLocationUpdate(MojoGeopositionPtr geoposition) override;
52 50
53 // Permission for using geolocation has been set. 51 // Permission for using geolocation has been set.
54 void OnPermissionSet(int bridge_id, bool is_allowed); 52 void OnPermissionSet(int permission_request_id, PermissionStatus status);
55 53
56 scoped_ptr<blink::WebGeolocationController> controller_; 54 scoped_ptr<blink::WebGeolocationController> controller_;
57 55
58 scoped_ptr<blink::WebGeolocationPermissionRequestManager> 56 scoped_ptr<blink::WebGeolocationPermissionRequestManager>
59 pending_permissions_; 57 pending_permissions_;
60 GeolocationServicePtr geolocation_service_; 58 GeolocationServicePtr geolocation_service_;
61 bool enable_high_accuracy_; 59 bool enable_high_accuracy_;
60 PermissionServicePtr permission_service_;
62 }; 61 };
63 62
64 } // namespace content 63 } // namespace content
65 64
66 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ 65 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/content_common_mojo_bindings.gypi ('k') | content/renderer/geolocation_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698