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