Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
update for chromium54 geo changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Dec 18, 2016
1 parent 0410ffa commit 24b947c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
18 changes: 0 additions & 18 deletions atom/browser/atom_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "atom/browser/api/atom_api_app.h"
#include "atom/browser/api/atom_api_protocol.h"
#include "atom/browser/atom_access_token_store.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_quota_permission_context.h"
Expand Down Expand Up @@ -37,7 +36,6 @@
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/web_preferences.h"
#include "device/geolocation/geolocation_delegate.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
#include "ui/base/l10n/l10n_util.h"
Expand All @@ -63,22 +61,6 @@ bool g_suppress_renderer_process_restart = false;
// Custom schemes to be registered to handle service worker.
std::string g_custom_service_worker_schemes = ""; // NOLINT

// A provider of Geolocation services to override AccessTokenStore.
class AtomGeolocationDelegate : public device::GeolocationDelegate {
public:
AtomGeolocationDelegate() = default;

scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final {
return new AtomAccessTokenStore();
}

private:
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
};

void Noop(scoped_refptr<content::SiteInstance>) {
}

} // namespace

// static
Expand Down
22 changes: 22 additions & 0 deletions atom/browser/atom_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "atom/browser/atom_browser_main_parts.h"

#include "atom/browser/api/trackable_object.h"
#include "atom/browser/atom_access_token_store.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_context.h"
#include "atom/browser/bridge_task_runner.h"
Expand All @@ -29,6 +30,8 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_switches.h"
#include "device/geolocation/geolocation_delegate.h"
#include "device/geolocation/geolocation_provider.h"
#include "gin/public/v8_platform.h"
#include "v8/include/libplatform/libplatform.h"
#include "v8/include/v8.h"
Expand All @@ -41,6 +44,22 @@

namespace atom {

// A provider of Geolocation services to override AccessTokenStore.
class AtomGeolocationDelegate : public device::GeolocationDelegate {
public:
AtomGeolocationDelegate() = default;

scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final {
return new AtomAccessTokenStore();
}

private:
DISALLOW_COPY_AND_ASSIGN(AtomGeolocationDelegate);
};

void Noop(scoped_refptr<content::SiteInstance>) {
}

template<typename T>
void Erase(T* container, typename T::iterator iter) {
container->erase(iter);
Expand Down Expand Up @@ -108,6 +127,9 @@ int AtomBrowserMainParts::PreCreateThreads() {
// Force MediaCaptureDevicesDispatcher to be created on UI thread.
brightray::MediaCaptureDevicesDispatcher::GetInstance();

device::GeolocationProvider::SetGeolocationDelegate(
new AtomGeolocationDelegate());

return BrowserMainParts::PreCreateThreads();
}

Expand Down

1 comment on commit 24b947c

@bbondy
Copy link
Member

@bbondy bbondy commented on 24b947c Dec 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.