| Index: chrome/browser/geolocation/win7_location_api_win.cc
|
| diff --git a/chrome/browser/geolocation/win7_location_api_win.cc b/chrome/browser/geolocation/win7_location_api_win.cc
|
| index 7b6c3ca352a9c052b47e92198ef8c8e43ce25ae2..0df55b5de81e71091e866386e856a7e3e8a1fdae 100644
|
| --- a/chrome/browser/geolocation/win7_location_api_win.cc
|
| +++ b/chrome/browser/geolocation/win7_location_api_win.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/file_path.h"
|
| #include "base/logging.h"
|
| #include "base/path_service.h"
|
| +#include "base/scoped_ptr.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/geoposition.h"
|
|
|
| @@ -26,13 +27,18 @@ HINSTANCE LoadWin7Library(const string16& lib_name) {
|
| }
|
| }
|
|
|
| -Win7LocationApi::Win7LocationApi(
|
| - HINSTANCE prop_library,
|
| +Win7LocationApi::Win7LocationApi()
|
| + : prop_lib_(0),
|
| + PropVariantToDouble_function_(0),
|
| + locator_(0) {
|
| +}
|
| +
|
| +void Win7LocationApi::Init(HINSTANCE prop_library,
|
| PropVariantToDoubleFunction PropVariantToDouble_function,
|
| - ILocation* locator)
|
| - : prop_lib_(prop_library),
|
| - PropVariantToDouble_function_(PropVariantToDouble_function),
|
| - locator_(locator) {
|
| + ILocation* locator) {
|
| + prop_lib_ = prop_library;
|
| + PropVariantToDouble_function_ = PropVariantToDouble_function;
|
| + locator_ = locator;
|
| }
|
|
|
| Win7LocationApi::~Win7LocationApi() {
|
| @@ -44,6 +50,8 @@ Win7LocationApi* Win7LocationApi::Create() {
|
| if (!CommandLine::ForCurrentProcess()
|
| ->HasSwitch(switches::kExperimentalLocationFeatures))
|
| return NULL;
|
| +
|
| + scoped_ptr<Win7LocationApi> result(new Win7LocationApi);
|
| // Load probsys.dll
|
| string16 lib_needed = L"propsys.dll";
|
| HINSTANCE prop_lib = LoadWin7Library(lib_needed);
|
| @@ -69,9 +77,8 @@ Win7LocationApi* Win7LocationApi::Create() {
|
| }
|
| IID reports_needed[] = { IID_ILatLongReport };
|
| result_type = locator->RequestPermissions(NULL, reports_needed, 1, TRUE);
|
| - return new Win7LocationApi(prop_lib,
|
| - PropVariantToDouble_function,
|
| - locator);
|
| + result->Init(prop_lib, PropVariantToDouble_function, locator);
|
| + return result.release();
|
| }
|
|
|
| void Win7LocationApi::GetPosition(Geoposition* position) {
|
|
|