mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 170167.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@932 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -10,12 +10,13 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/logging.h"
|
||||
#include "content/browser/geolocation/arbitrator_dependency_factory.h"
|
||||
#include "content/browser/geolocation/geolocation_observer.h"
|
||||
#include "content/browser/geolocation/geolocation_provider.h"
|
||||
#include "content/browser/geolocation/location_provider.h"
|
||||
#include "content/public/browser/access_token_store.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "content/public/common/geoposition.h"
|
||||
#include "content/public/common/content_client.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "net/url_request/url_request_context_getter.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationPermissionRequest.h"
|
||||
@ -25,6 +26,7 @@
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebGeolocationError.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
||||
#include "webkit/user_agent/user_agent.h"
|
||||
|
||||
using WebKit::WebGeolocationController;
|
||||
using WebKit::WebGeolocationError;
|
||||
@ -75,6 +77,26 @@ class CefAccessTokenStore : public content::AccessTokenStore {
|
||||
DISALLOW_COPY_AND_ASSIGN(CefAccessTokenStore);
|
||||
};
|
||||
|
||||
// Stub implementation of ContentClient.
|
||||
class CefContentClient : public content::ContentClient {
|
||||
public:
|
||||
CefContentClient() {}
|
||||
|
||||
virtual std::string GetUserAgent() const OVERRIDE {
|
||||
return webkit_glue::GetUserAgent(GURL());
|
||||
}
|
||||
};
|
||||
|
||||
// Stub implementation of ContentBrowserClient.
|
||||
class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
public:
|
||||
CefContentBrowserClient() {}
|
||||
|
||||
virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE {
|
||||
return new CefAccessTokenStore();
|
||||
}
|
||||
};
|
||||
|
||||
void NotifyArbitratorPermissionGranted() {
|
||||
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||
content::GeolocationProvider::GetInstance()->OnPermissionGranted();
|
||||
@ -221,6 +243,15 @@ void CefGeolocationClient::cancelPermissionRequest(
|
||||
void CefGeolocationClient::OnStartUpdating(bool enable_high_accuracy) {
|
||||
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||
|
||||
// GeolocationArbitrator uses ContentClient to retrieve the AccessTokenStore.
|
||||
// Simulate the necessary interfaces here.
|
||||
if (!content::GetContentClient()) {
|
||||
static CefContentClient content_client;
|
||||
static CefContentBrowserClient browser_client;
|
||||
content_client.set_browser_for_testing(&browser_client);
|
||||
content::SetContentClient(&content_client);
|
||||
}
|
||||
|
||||
if (!location_provider_)
|
||||
location_provider_ = content::GeolocationProvider::GetInstance();
|
||||
|
||||
@ -307,46 +338,6 @@ void CefGeolocationClient::OnPositionUpdated(
|
||||
}
|
||||
|
||||
|
||||
// Replacement for content/browser/geolocation/arbitrator_dependency_factory.cc
|
||||
|
||||
// GeolocationArbitratorDependencyFactory
|
||||
content::GeolocationArbitratorDependencyFactory::
|
||||
~GeolocationArbitratorDependencyFactory() {
|
||||
}
|
||||
|
||||
// DefaultGeolocationArbitratorDependencyFactory
|
||||
content::DefaultGeolocationArbitratorDependencyFactory::
|
||||
~DefaultGeolocationArbitratorDependencyFactory() {
|
||||
}
|
||||
|
||||
content::DefaultGeolocationArbitratorDependencyFactory::GetTimeNow
|
||||
content::DefaultGeolocationArbitratorDependencyFactory::GetTimeFunction() {
|
||||
return base::Time::Now;
|
||||
}
|
||||
|
||||
content::AccessTokenStore*
|
||||
content::DefaultGeolocationArbitratorDependencyFactory::NewAccessTokenStore() {
|
||||
return new CefAccessTokenStore;
|
||||
}
|
||||
|
||||
content::LocationProviderBase*
|
||||
content::DefaultGeolocationArbitratorDependencyFactory::
|
||||
NewNetworkLocationProvider(
|
||||
content::AccessTokenStore* access_token_store,
|
||||
net::URLRequestContextGetter* context,
|
||||
const GURL& url,
|
||||
const string16& access_token) {
|
||||
return content::NewNetworkLocationProvider(access_token_store, context,
|
||||
url, access_token);
|
||||
}
|
||||
|
||||
content::LocationProviderBase*
|
||||
content::DefaultGeolocationArbitratorDependencyFactory::
|
||||
NewSystemLocationProvider() {
|
||||
return content::NewSystemLocationProvider();
|
||||
}
|
||||
|
||||
|
||||
// Extract from content/public/common/content_switches.cc.
|
||||
|
||||
namespace switches {
|
||||
|
Reference in New Issue
Block a user