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

Side by Side Diff: blimp/engine/app/blimp_content_browser_client.cc

Issue 2126893003: Geolocation cleanup: make GeolocationDelegate::OverrideSystemLocationProvider return unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/mojo/blob_channel_service.h" 9 #include "blimp/engine/mojo/blob_channel_service.h"
10 #include "content/public/browser/geolocation_delegate.h" 10 #include "content/public/browser/geolocation_delegate.h"
11 #include "services/shell/public/cpp/interface_registry.h" 11 #include "services/shell/public/cpp/interface_registry.h"
12 12
13 namespace blimp { 13 namespace blimp {
14 namespace engine { 14 namespace engine {
15 15
16 namespace { 16 namespace {
17 // A provider of services needed by Geolocation. 17 // A provider of services needed by Geolocation.
18 class BlimpGeolocationDelegate : public content::GeolocationDelegate { 18 class BlimpGeolocationDelegate : public content::GeolocationDelegate {
19 public: 19 public:
20 BlimpGeolocationDelegate() = default; 20 BlimpGeolocationDelegate() = default;
21 21
22 bool UseNetworkLocationProviders() final { return false; } 22 bool UseNetworkLocationProviders() final { return false; }
23 23
24 content::LocationProvider* OverrideSystemLocationProvider() final { 24 std::unique_ptr<content::LocationProvider> OverrideSystemLocationProvider()
25 if (!location_provider_) 25 final {
26 location_provider_ = base::WrapUnique(new BlimpLocationProvider()); 26 return base::WrapUnique(new BlimpLocationProvider());
27 return location_provider_.get();
28 } 27 }
29 28
30 private: 29 private:
31 std::unique_ptr<BlimpLocationProvider> location_provider_;
Wez 2016/07/07 18:51:39 You're changing the ownership semantics here - was
mcasas 2016/07/07 19:07:09 Probably - the result of OverrideSystemLocationPro
32
33 DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate); 30 DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate);
34 }; 31 };
35 32
36 } // anonymous namespace 33 } // anonymous namespace
37 34
38 BlimpContentBrowserClient::BlimpContentBrowserClient() {} 35 BlimpContentBrowserClient::BlimpContentBrowserClient() {}
39 36
40 BlimpContentBrowserClient::~BlimpContentBrowserClient() {} 37 BlimpContentBrowserClient::~BlimpContentBrowserClient() {}
41 38
42 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts( 39 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts(
(...skipping 28 matching lines...) Expand all
71 void BlimpContentBrowserClient::ExposeInterfacesToRenderer( 68 void BlimpContentBrowserClient::ExposeInterfacesToRenderer(
72 shell::InterfaceRegistry* registry, 69 shell::InterfaceRegistry* registry,
73 content::RenderProcessHost* render_process_host) { 70 content::RenderProcessHost* render_process_host) {
74 registry->AddInterface<mojom::BlobChannel>( 71 registry->AddInterface<mojom::BlobChannel>(
75 base::Bind(&BlobChannelService::Create, 72 base::Bind(&BlobChannelService::Create,
76 blimp_browser_main_parts_->GetBlobChannelSender())); 73 blimp_browser_main_parts_->GetBlobChannelSender()));
77 } 74 }
78 75
79 } // namespace engine 76 } // namespace engine
80 } // namespace blimp 77 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698