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

Side by Side 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: Remove DLOG(FATAL)-related tests 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/engine/app/blimp_content_browser_client.h" 5 #include "blimp/engine/app/blimp_content_browser_client.h"
6 #include "blimp/engine/app/blimp_browser_main_parts.h" 6 #include "blimp/engine/app/blimp_browser_main_parts.h"
7 #include "blimp/engine/app/settings_manager.h" 7 #include "blimp/engine/app/settings_manager.h"
8 #include "blimp/engine/feature/geolocation/blimp_location_provider.h" 8 #include "blimp/engine/feature/geolocation/blimp_location_provider.h"
9 #include "blimp/engine/feature/geolocation/engine_geolocation_feature.h"
9 #include "blimp/engine/mojo/blob_channel_service.h" 10 #include "blimp/engine/mojo/blob_channel_service.h"
11 #include "blimp/engine/session/blimp_engine_session.h"
10 #include "content/public/browser/geolocation_delegate.h" 12 #include "content/public/browser/geolocation_delegate.h"
11 #include "services/shell/public/cpp/interface_registry.h" 13 #include "services/shell/public/cpp/interface_registry.h"
12 14
13 namespace blimp { 15 namespace blimp {
14 namespace engine { 16 namespace engine {
15 17
16 namespace {
17 // A provider of services needed by Geolocation.
18 class BlimpGeolocationDelegate : public content::GeolocationDelegate {
19 public:
20 BlimpGeolocationDelegate() = default;
21
22 bool UseNetworkLocationProviders() final { return false; }
23
24 std::unique_ptr<content::LocationProvider> OverrideSystemLocationProvider()
25 final {
26 return base::WrapUnique(new BlimpLocationProvider());
27 }
28
29 private:
30 DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate);
31 };
32
33 } // anonymous namespace
34
35 BlimpContentBrowserClient::BlimpContentBrowserClient() {} 18 BlimpContentBrowserClient::BlimpContentBrowserClient() {}
36 19
37 BlimpContentBrowserClient::~BlimpContentBrowserClient() {} 20 BlimpContentBrowserClient::~BlimpContentBrowserClient() {}
38 21
39 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts( 22 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts(
40 const content::MainFunctionParams& parameters) { 23 const content::MainFunctionParams& parameters) {
41 blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters); 24 blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters);
42 // BrowserMainLoop takes ownership of the returned BrowserMainParts. 25 // BrowserMainLoop takes ownership of the returned BrowserMainParts.
43 return blimp_browser_main_parts_; 26 return blimp_browser_main_parts_;
44 } 27 }
(...skipping 10 matching lines...) Expand all
55 blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences( 38 blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences(
56 prefs); 39 prefs);
57 } 40 }
58 41
59 BlimpBrowserContext* BlimpContentBrowserClient::GetBrowserContext() { 42 BlimpBrowserContext* BlimpContentBrowserClient::GetBrowserContext() {
60 return blimp_browser_main_parts_->GetBrowserContext(); 43 return blimp_browser_main_parts_->GetBrowserContext();
61 } 44 }
62 45
63 content::GeolocationDelegate* 46 content::GeolocationDelegate*
64 BlimpContentBrowserClient::CreateGeolocationDelegate() { 47 BlimpContentBrowserClient::CreateGeolocationDelegate() {
65 return new BlimpGeolocationDelegate(); 48 EngineGeolocationFeature* geolocation_feature = blimp_browser_main_parts()
49 ->GetBlimpEngineSession()
50 ->GetGeolocationFeature();
51 return geolocation_feature->CreateGeolocationDelegate().release();
66 } 52 }
67 53
68 void BlimpContentBrowserClient::ExposeInterfacesToRenderer( 54 void BlimpContentBrowserClient::ExposeInterfacesToRenderer(
69 shell::InterfaceRegistry* registry, 55 shell::InterfaceRegistry* registry,
70 content::RenderProcessHost* render_process_host) { 56 content::RenderProcessHost* render_process_host) {
71 registry->AddInterface<mojom::BlobChannel>( 57 registry->AddInterface<mojom::BlobChannel>(
72 base::Bind(&BlobChannelService::Create, 58 base::Bind(&BlobChannelService::Create,
73 blimp_browser_main_parts_->GetBlobChannelSender())); 59 blimp_browser_main_parts_->GetBlobChannelSender()));
74 } 60 }
75 61
76 } // namespace engine 62 } // namespace engine
77 } // namespace blimp 63 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698