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

Side by Side Diff: content/browser/geolocation/win7_location_api_win.h

Issue 6597044: Revert 76228 - Move core pieces of geolocation from chrome to content.This is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_API_WIN_H_
6 #define CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_API_WIN_H_
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <locationapi.h>
11 #include <sensors.h>
12 #include <Windows.h>
13
14 #include "app/win/scoped_com_initializer.h"
15 #include "base/time.h"
16
17 struct Geoposition;
18
19 // PropVariantToDouble
20 typedef HRESULT (WINAPI* PropVariantToDoubleFunction)
21 (REFPROPVARIANT propvarIn, DOUBLE *pdblRet);
22
23 class Win7LocationApi {
24 public:
25 virtual ~Win7LocationApi();
26 // Attempts to load propsys.dll, initialise |location_| and requests the user
27 // for access to location information. Creates and returns ownership of an
28 // instance of Win7LocationApi if all succeed.
29 static Win7LocationApi* Create();
30 static Win7LocationApi* CreateForTesting(
31 PropVariantToDoubleFunction PropVariantToDouble_function,
32 ILocation* locator);
33 // Gives the best available position.
34 // Returns false if no valid position is available.
35 virtual void GetPosition(Geoposition* position);
36 // Changes the "accuracy" needed. Affects power levels of devices.
37 virtual bool SetHighAccuracy(bool acc);
38
39 protected:
40 Win7LocationApi();
41
42 private:
43 void Init(HINSTANCE prop_library,
44 PropVariantToDoubleFunction PropVariantToDouble_function,
45 ILocation* locator);
46
47 // Provides the best position fix if one is available.
48 // Does this by requesting a location report and querying it to obtain
49 // location information.
50 virtual bool GetPositionIfFixed(Geoposition* position);
51
52 // Ensure that COM has been initialized for this thread.
53 app::win::ScopedCOMInitializer com_initializer_;
54 // ILocation object that lets us communicate with the Location and
55 // Sensors platform.
56 CComPtr<ILocation> locator_;
57 // Holds the opened propsys.dll library that is passed on construction.
58 // This class is responsible for closing it.
59 HINSTANCE prop_lib_;
60 PropVariantToDoubleFunction PropVariantToDouble_function_;
61
62 DISALLOW_COPY_AND_ASSIGN(Win7LocationApi);
63 };
64
65 #endif // CONTENT_BROWSER_GEOLOCATION_WIN7_LOCATION_API_WIN_H_
OLDNEW
« no previous file with comments | « content/browser/geolocation/win7_location_api_unittest_win.cc ('k') | content/browser/geolocation/win7_location_api_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698