| 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 "base/json/json_reader.h" | 5 #include "base/json/json_reader.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/blimp_content_browser_client.h" | 7 #include "blimp/engine/app/blimp_content_browser_client.h" |
| 8 #include "blimp/engine/app/settings_manager.h" | 8 #include "blimp/engine/app/settings_manager.h" |
| 9 #include "blimp/engine/grit/blimp_browser_resources.h" | 9 #include "blimp/engine/grit/blimp_browser_resources.h" |
| 10 #include "blimp/engine/mojo/blob_channel_service.h" | 10 #include "blimp/engine/mojo/blob_channel_service.h" |
| 11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/common/service_names.mojom.h" | 12 #include "content/public/common/service_names.mojom.h" |
| 13 #include "services/service_manager/public/cpp/interface_registry.h" | 13 #include "services/service_manager/public/cpp/interface_registry.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 | 15 |
| 16 namespace blimp { | 16 namespace blimp { |
| 17 namespace engine { | 17 namespace engine { |
| 18 | 18 |
| 19 BlimpContentBrowserClient::BlimpContentBrowserClient() {} | 19 BlimpContentBrowserClient::BlimpContentBrowserClient() {} |
| 20 | 20 |
| 21 BlimpContentBrowserClient::~BlimpContentBrowserClient() {} | 21 BlimpContentBrowserClient::~BlimpContentBrowserClient() {} |
| 22 | 22 |
| 23 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts( | 23 content::BrowserMainParts* BlimpContentBrowserClient::CreateBrowserMainParts( |
| 24 const content::MainFunctionParams& parameters) { | 24 const content::MainFunctionParams& parameters) { |
| 25 blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters); | 25 blimp_browser_main_parts_ = new BlimpBrowserMainParts(parameters); |
| 26 // BrowserMainLoop takes ownership of the returned BrowserMainParts. | 26 // BrowserMainLoop takes ownership of the returned BrowserMainParts. |
| 27 return blimp_browser_main_parts_; | 27 return blimp_browser_main_parts_; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void BlimpContentBrowserClient::SetBrowserMainPartsForTesting( |
| 31 BlimpBrowserMainParts* blimp_browser_main_parts) { |
| 32 blimp_browser_main_parts_ = blimp_browser_main_parts; |
| 33 } |
| 34 |
| 30 void BlimpContentBrowserClient::OverrideWebkitPrefs( | 35 void BlimpContentBrowserClient::OverrideWebkitPrefs( |
| 31 content::RenderViewHost* render_view_host, | 36 content::RenderViewHost* render_view_host, |
| 32 content::WebPreferences* prefs) { | 37 content::WebPreferences* prefs) { |
| 33 if (!blimp_browser_main_parts_) | 38 if (!blimp_browser_main_parts_) |
| 34 return; | 39 return; |
| 35 | 40 |
| 36 if (!blimp_browser_main_parts_->GetSettingsManager()) | 41 if (!blimp_browser_main_parts_->GetSettingsManager()) |
| 37 return; | 42 return; |
| 38 | 43 |
| 39 blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences( | 44 blimp_browser_main_parts_->GetSettingsManager()->UpdateWebkitPreferences( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 return nullptr; | 68 return nullptr; |
| 64 } | 69 } |
| 65 | 70 |
| 66 base::StringPiece manifest_contents = | 71 base::StringPiece manifest_contents = |
| 67 rb.GetRawDataResourceForScale(id, ui::ScaleFactor::SCALE_FACTOR_NONE); | 72 rb.GetRawDataResourceForScale(id, ui::ScaleFactor::SCALE_FACTOR_NONE); |
| 68 return base::JSONReader::Read(manifest_contents); | 73 return base::JSONReader::Read(manifest_contents); |
| 69 } | 74 } |
| 70 | 75 |
| 71 } // namespace engine | 76 } // namespace engine |
| 72 } // namespace blimp | 77 } // namespace blimp |
| OLD | NEW |