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

Unified Diff: blimp/engine/app/blimp_content_browser_client.cc

Issue 2091023006: Adds EngineGeolocationFeature for Blimp Geolocation project. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating repo to see if try is fixed Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: blimp/engine/app/blimp_content_browser_client.cc
diff --git a/blimp/engine/app/blimp_content_browser_client.cc b/blimp/engine/app/blimp_content_browser_client.cc
index 90ea2f52e4c78637305c63ea9346ec75d5085f3b..fad04ea106d8b1bdb669241b45fa6f69f273d711 100644
--- a/blimp/engine/app/blimp_content_browser_client.cc
+++ b/blimp/engine/app/blimp_content_browser_client.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/weak_ptr.h"
#include "blimp/engine/app/blimp_content_browser_client.h"
#include "blimp/engine/app/blimp_browser_main_parts.h"
#include "blimp/engine/app/settings_manager.h"
#include "blimp/engine/feature/geolocation/blimp_location_provider.h"
+#include "blimp/engine/feature/geolocation/engine_geolocation_feature.h"
#include "blimp/engine/mojo/blob_channel_service.h"
+#include "blimp/engine/session/blimp_engine_session.h"
#include "content/public/browser/geolocation_delegate.h"
#include "services/shell/public/cpp/interface_registry.h"
@@ -17,16 +20,23 @@ namespace {
// A provider of services needed by Geolocation.
class BlimpGeolocationDelegate : public content::GeolocationDelegate {
public:
- BlimpGeolocationDelegate() = default;
+ explicit BlimpGeolocationDelegate(
+ base::WeakPtr<EngineGeolocationFeature> feature) {
Wez 2016/07/12 21:35:12 nit: Looks like you mean to just pass WeakPtr<Blim
CJ 2016/07/13 21:49:19 Done.
+ feature_ = feature;
+ }
bool UseNetworkLocationProviders() final { return false; }
- std::unique_ptr<content::LocationProvider> OverrideSystemLocationProvider()
- final {
- return base::WrapUnique(new BlimpLocationProvider());
+ std::unique_ptr<content::LocationProvider>
+ OverrideSystemLocationProvider() final {
+ BlimpLocationProvider* location_provider = new BlimpLocationProvider();
+ location_provider->SetDelegate(feature_);
+ return base::WrapUnique(location_provider);
}
private:
+ base::WeakPtr<BlimpLocationProvider::Delegate> feature_;
Wez 2016/07/12 21:35:12 You're assigning this from an EngineGeolocationFea
CJ 2016/07/13 21:49:19 It does. EngineGeolocationFeature is a BlimpLocati
Wez 2016/07/14 01:19:21 Right, but it's strange to require that the caller
CJ 2016/07/14 23:55:08 Acknowledged.
+
DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate);
};
@@ -62,7 +72,12 @@ BlimpBrowserContext* BlimpContentBrowserClient::GetBrowserContext() {
content::GeolocationDelegate*
BlimpContentBrowserClient::CreateGeolocationDelegate() {
- return new BlimpGeolocationDelegate();
+ EngineGeolocationFeature* geolocation_feature = blimp_browser_main_parts()
+ ->GetBlimpEngineSession()
+ ->GetGeolocationFeature();
Wez 2016/07/12 21:35:12 nit: Is this the git cl format preferred line-wrap
CJ 2016/07/13 21:49:19 Yes.
+ BlimpGeolocationDelegate* delegate =
+ new BlimpGeolocationDelegate(geolocation_feature->GetWeakPtr());
Wez 2016/07/12 21:35:13 Rather than expose WeakPtr<EngineGelocationFeature
CJ 2016/07/13 21:49:19 BlimpGeolocationDelegate has nothing to do with En
Wez 2016/07/14 01:19:21 I'm not sure what you mean by "has nothing to do w
CJ 2016/07/14 23:55:08 Done.
+ return delegate;
}
void BlimpContentBrowserClient::ExposeInterfacesToRenderer(

Powered by Google App Engine
This is Rietveld 408576698