| OLD | NEW |
| 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/common/blimp_browser_context.h" | |
| 9 #include "blimp/engine/mojo/blob_channel_service.h" | 8 #include "blimp/engine/mojo/blob_channel_service.h" |
| 10 #include "content/public/common/service_registry.h" | 9 #include "content/public/common/service_registry.h" |
| 11 | 10 |
| 12 namespace blimp { | 11 namespace blimp { |
| 13 namespace engine { | 12 namespace engine { |
| 14 | 13 |
| 15 BlimpContentBrowserClient::BlimpContentBrowserClient() {} | 14 BlimpContentBrowserClient::BlimpContentBrowserClient() {} |
| 16 | 15 |
| 17 BlimpContentBrowserClient::~BlimpContentBrowserClient() {} | 16 BlimpContentBrowserClient::~BlimpContentBrowserClient() {} |
| 18 | 17 |
| 19 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts( | 18 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts( |
| 20 const content::MainFunctionParams& parameters) { | 19 const content::MainFunctionParams& parameters) { |
| 21 blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters); | 20 blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters); |
| 22 // BrowserMainLoop takes ownership of the returned BrowserMainParts. | 21 // BrowserMainLoop takes ownership of the returned BrowserMainParts. |
| 23 return blimp_browser_main_parts_; | 22 return blimp_browser_main_parts_; |
| 24 } | 23 } |
| 25 | 24 |
| 26 net::URLRequestContextGetter* BlimpContentBrowserClient::CreateRequestContext( | |
| 27 content::BrowserContext* content_browser_context, | |
| 28 content::ProtocolHandlerMap* protocol_handlers, | |
| 29 content::URLRequestInterceptorScopedVector request_interceptors) { | |
| 30 BlimpBrowserContext* blimp_context = | |
| 31 static_cast<BlimpBrowserContext*>(content_browser_context); | |
| 32 return blimp_context->CreateRequestContext(protocol_handlers, | |
| 33 std::move(request_interceptors)) | |
| 34 .get(); | |
| 35 } | |
| 36 | |
| 37 void BlimpContentBrowserClient::OverrideWebkitPrefs( | 25 void BlimpContentBrowserClient::OverrideWebkitPrefs( |
| 38 content::RenderViewHost* render_view_host, | 26 content::RenderViewHost* render_view_host, |
| 39 content::WebPreferences* prefs) { | 27 content::WebPreferences* prefs) { |
| 40 if (!blimp_browser_main_parts_) | 28 if (!blimp_browser_main_parts_) |
| 41 return; | 29 return; |
| 42 | 30 |
| 43 if (!blimp_browser_main_parts_->GetSettingsManager()) | 31 if (!blimp_browser_main_parts_->GetSettingsManager()) |
| 44 return; | 32 return; |
| 45 | 33 |
| 46 blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences( | 34 blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences( |
| 47 prefs); | 35 prefs); |
| 48 } | 36 } |
| 49 | 37 |
| 50 BlimpBrowserContext* BlimpContentBrowserClient::GetBrowserContext() { | 38 BlimpBrowserContext* BlimpContentBrowserClient::GetBrowserContext() { |
| 51 return blimp_browser_main_parts_->GetBrowserContext(); | 39 return blimp_browser_main_parts_->GetBrowserContext(); |
| 52 } | 40 } |
| 53 | 41 |
| 54 void BlimpContentBrowserClient::RegisterRenderProcessMojoServices( | 42 void BlimpContentBrowserClient::RegisterRenderProcessMojoServices( |
| 55 content::ServiceRegistry* registry) { | 43 content::ServiceRegistry* registry) { |
| 56 registry->AddService<mojom::BlobChannel>( | 44 registry->AddService<mojom::BlobChannel>( |
| 57 base::Bind(&BlobChannelService::Create)); | 45 base::Bind(&BlobChannelService::Create)); |
| 58 } | 46 } |
| 59 | 47 |
| 60 } // namespace engine | 48 } // namespace engine |
| 61 } // namespace blimp | 49 } // namespace blimp |
| OLD | NEW |