| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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_browser_main_parts.h" | 5 #include "blimp/engine/app/blimp_browser_main_parts.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "blimp/common/proto/blimp_message.pb.h" | 10 #include "blimp/common/proto/blimp_message.pb.h" |
| 11 #include "blimp/engine/app/blimp_engine_config.h" | 11 #include "blimp/engine/app/blimp_engine_config.h" |
| 12 #include "blimp/engine/app/settings_manager.h" | 12 #include "blimp/engine/app/settings_manager.h" |
| 13 #include "blimp/engine/common/blimp_browser_context.h" | 13 #include "blimp/engine/common/blimp_browser_context.h" |
| 14 #include "blimp/engine/feature/geolocation/blimp_location_provider.h" | 14 #include "blimp/engine/feature/geolocation/blimp_location_provider.h" |
| 15 #include "blimp/engine/session/blimp_engine_session.h" | 15 #include "blimp/engine/session/blimp_engine_session.h" |
| 16 #include "blimp/net/blimp_connection.h" | 16 #include "blimp/net/blimp_connection.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/geolocation_delegate.h" | |
| 19 #include "content/public/browser/geolocation_provider.h" | |
| 20 #include "content/public/common/main_function_params.h" | 18 #include "content/public/common/main_function_params.h" |
| 19 #include "device/geolocation/public/cpp/geolocation_delegate.h" |
| 20 #include "device/geolocation/public/cpp/geolocation_provider.h" |
| 21 #include "net/base/net_module.h" | 21 #include "net/base/net_module.h" |
| 22 #include "net/log/net_log.h" | 22 #include "net/log/net_log.h" |
| 23 | 23 |
| 24 namespace blimp { | 24 namespace blimp { |
| 25 namespace engine { | 25 namespace engine { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 // A provider of services needed by Geolocation. | 28 // A provider of services needed by Geolocation. |
| 29 class BlimpGeolocationDelegate : public content::GeolocationDelegate { | 29 class BlimpGeolocationDelegate : public device::GeolocationDelegate { |
| 30 public: | 30 public: |
| 31 BlimpGeolocationDelegate() = default; | 31 BlimpGeolocationDelegate() = default; |
| 32 | 32 |
| 33 bool UseNetworkLocationProviders() final { return false; } | 33 bool UseNetworkLocationProviders() final { return false; } |
| 34 | 34 |
| 35 std::unique_ptr<content::LocationProvider> OverrideSystemLocationProvider() | 35 std::unique_ptr<device::LocationProvider> OverrideSystemLocationProvider() |
| 36 final { | 36 final { |
| 37 return base::WrapUnique(new BlimpLocationProvider()); | 37 return base::WrapUnique(new BlimpLocationProvider()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate); | 41 DISALLOW_COPY_AND_ASSIGN(BlimpGeolocationDelegate); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // anonymous namespace | 44 } // anonymous namespace |
| 45 | 45 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 engine_config_ = BlimpEngineConfig::Create(*cmd_line); | 58 engine_config_ = BlimpEngineConfig::Create(*cmd_line); |
| 59 CHECK(engine_config_); | 59 CHECK(engine_config_); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 void BlimpBrowserMainParts::PreMainMessageLoopRun() { | 63 void BlimpBrowserMainParts::PreMainMessageLoopRun() { |
| 64 net_log_.reset(new net::NetLog()); | 64 net_log_.reset(new net::NetLog()); |
| 65 settings_manager_.reset(new SettingsManager); | 65 settings_manager_.reset(new SettingsManager); |
| 66 std::unique_ptr<BlimpBrowserContext> browser_context( | 66 std::unique_ptr<BlimpBrowserContext> browser_context( |
| 67 new BlimpBrowserContext(false, net_log_.get())); | 67 new BlimpBrowserContext(false, net_log_.get())); |
| 68 content::GeolocationProvider::SetGeolocationDelegate( | 68 device::GeolocationProvider::SetGeolocationDelegate( |
| 69 new BlimpGeolocationDelegate()); | 69 new BlimpGeolocationDelegate()); |
| 70 engine_session_.reset( | 70 engine_session_.reset( |
| 71 new BlimpEngineSession(std::move(browser_context), net_log_.get(), | 71 new BlimpEngineSession(std::move(browser_context), net_log_.get(), |
| 72 engine_config_.get(), settings_manager_.get())); | 72 engine_config_.get(), settings_manager_.get())); |
| 73 engine_session_->Initialize(); | 73 engine_session_->Initialize(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void BlimpBrowserMainParts::PostMainMessageLoopRun() { | 76 void BlimpBrowserMainParts::PostMainMessageLoopRun() { |
| 77 engine_session_.reset(); | 77 engine_session_.reset(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 BlimpBrowserContext* BlimpBrowserMainParts::GetBrowserContext() { | 80 BlimpBrowserContext* BlimpBrowserMainParts::GetBrowserContext() { |
| 81 return engine_session_->browser_context(); | 81 return engine_session_->browser_context(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 SettingsManager* BlimpBrowserMainParts::GetSettingsManager() { | 84 SettingsManager* BlimpBrowserMainParts::GetSettingsManager() { |
| 85 return settings_manager_.get(); | 85 return settings_manager_.get(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 BlobChannelSender* BlimpBrowserMainParts::GetBlobChannelSender() { | 88 BlobChannelSender* BlimpBrowserMainParts::GetBlobChannelSender() { |
| 89 return engine_session_->blob_channel_sender(); | 89 return engine_session_->blob_channel_sender(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 BlimpEngineSession* BlimpBrowserMainParts::GetBlimpEngineSession() { | 92 BlimpEngineSession* BlimpBrowserMainParts::GetBlimpEngineSession() { |
| 93 return engine_session_.get(); | 93 return engine_session_.get(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace engine | 96 } // namespace engine |
| 97 } // namespace blimp | 97 } // namespace blimp |
| OLD | NEW |