| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/shell/browser/cast_content_browser_client.h" | 5 #include "chromecast/shell/browser/cast_content_browser_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chromecast/shell/browser/cast_browser_context.h" | 8 #include "chromecast/shell/browser/cast_browser_context.h" |
| 9 #include "chromecast/shell/browser/cast_browser_main_parts.h" | 9 #include "chromecast/shell/browser/cast_browser_main_parts.h" |
| 10 #include "chromecast/shell/browser/cast_browser_process.h" |
| 10 #include "chromecast/shell/browser/geolocation/cast_access_token_store.h" | 11 #include "chromecast/shell/browser/geolocation/cast_access_token_store.h" |
| 11 #include "chromecast/shell/browser/url_request_context_factory.h" | 12 #include "chromecast/shell/browser/url_request_context_factory.h" |
| 12 #include "content/public/browser/certificate_request_result_type.h" | 13 #include "content/public/browser/certificate_request_result_type.h" |
| 13 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 14 #include "content/public/common/content_descriptors.h" | 15 #include "content/public/common/content_descriptors.h" |
| 15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 16 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
| 17 #include "content/public/common/web_preferences.h" | 18 #include "content/public/common/web_preferences.h" |
| 18 | 19 |
| 19 namespace chromecast { | 20 namespace chromecast { |
| 20 namespace shell { | 21 namespace shell { |
| 21 | 22 |
| 22 CastContentBrowserClient::CastContentBrowserClient() | 23 CastContentBrowserClient::CastContentBrowserClient() |
| 23 : url_request_context_factory_(new URLRequestContextFactory()) { | 24 : url_request_context_factory_(new URLRequestContextFactory()) { |
| 24 } | 25 } |
| 25 | 26 |
| 26 CastContentBrowserClient::~CastContentBrowserClient() { | 27 CastContentBrowserClient::~CastContentBrowserClient() { |
| 27 } | 28 } |
| 28 | 29 |
| 29 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( | 30 content::BrowserMainParts* CastContentBrowserClient::CreateBrowserMainParts( |
| 30 const content::MainFunctionParams& parameters) { | 31 const content::MainFunctionParams& parameters) { |
| 31 shell_browser_main_parts_ = | 32 return new CastBrowserMainParts(parameters, |
| 32 new CastBrowserMainParts(parameters, url_request_context_factory_.get()); | 33 url_request_context_factory_.get()); |
| 33 return shell_browser_main_parts_; | |
| 34 } | 34 } |
| 35 | 35 |
| 36 void CastContentBrowserClient::RenderProcessWillLaunch( | 36 void CastContentBrowserClient::RenderProcessWillLaunch( |
| 37 content::RenderProcessHost* host) { | 37 content::RenderProcessHost* host) { |
| 38 } | 38 } |
| 39 | 39 |
| 40 net::URLRequestContextGetter* CastContentBrowserClient::CreateRequestContext( | 40 net::URLRequestContextGetter* CastContentBrowserClient::CreateRequestContext( |
| 41 content::BrowserContext* browser_context, | 41 content::BrowserContext* browser_context, |
| 42 content::ProtocolHandlerMap* protocol_handlers, | 42 content::ProtocolHandlerMap* protocol_handlers, |
| 43 content::URLRequestInterceptorScopedVector request_interceptors) { | 43 content::URLRequestInterceptorScopedVector request_interceptors) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 74 std::string process_type = | 74 std::string process_type = |
| 75 command_line->GetSwitchValueNative(switches::kProcessType); | 75 command_line->GetSwitchValueNative(switches::kProcessType); |
| 76 // Renderer process comamndline | 76 // Renderer process comamndline |
| 77 if (process_type == switches::kRendererProcess) { | 77 if (process_type == switches::kRendererProcess) { |
| 78 // Any browser command-line switches that should be propagated to | 78 // Any browser command-line switches that should be propagated to |
| 79 // the renderer go here. | 79 // the renderer go here. |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { | 83 content::AccessTokenStore* CastContentBrowserClient::CreateAccessTokenStore() { |
| 84 return new CastAccessTokenStore(shell_browser_main_parts_->browser_context()); | 84 return new CastAccessTokenStore( |
| 85 CastBrowserProcess::GetInstance()->browser_context()); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void CastContentBrowserClient::OverrideWebkitPrefs( | 88 void CastContentBrowserClient::OverrideWebkitPrefs( |
| 88 content::RenderViewHost* render_view_host, | 89 content::RenderViewHost* render_view_host, |
| 89 const GURL& url, | 90 const GURL& url, |
| 90 content::WebPreferences* prefs) { | 91 content::WebPreferences* prefs) { |
| 91 prefs->allow_scripts_to_close_windows = true; | 92 prefs->allow_scripts_to_close_windows = true; |
| 92 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default | 93 // TODO(lcwu): http://crbug.com/391089. This pref is set to true by default |
| 93 // because some content providers such as YouTube use plain http requests | 94 // because some content providers such as YouTube use plain http requests |
| 94 // to retrieve media data chunks while running in a https page. This pref | 95 // to retrieve media data chunks while running in a https page. This pref |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 139 } |
| 139 | 140 |
| 140 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 141 void CastContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
| 141 const base::CommandLine& command_line, | 142 const base::CommandLine& command_line, |
| 142 int child_process_id, | 143 int child_process_id, |
| 143 std::vector<content::FileDescriptorInfo>* mappings) { | 144 std::vector<content::FileDescriptorInfo>* mappings) { |
| 144 } | 145 } |
| 145 | 146 |
| 146 } // namespace shell | 147 } // namespace shell |
| 147 } // namespace chromecast | 148 } // namespace chromecast |
| OLD | NEW |