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/browser/cast_content_browser_client.h" | 5 #include "chromecast/browser/cast_content_browser_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "chromecast/base/cast_constants.h" | 22 #include "chromecast/base/cast_constants.h" |
22 #include "chromecast/base/cast_paths.h" | 23 #include "chromecast/base/cast_paths.h" |
23 #include "chromecast/base/chromecast_switches.h" | 24 #include "chromecast/base/chromecast_switches.h" |
24 #include "chromecast/browser/cast_browser_context.h" | 25 #include "chromecast/browser/cast_browser_context.h" |
25 #include "chromecast/browser/cast_browser_main_parts.h" | 26 #include "chromecast/browser/cast_browser_main_parts.h" |
26 #include "chromecast/browser/cast_browser_process.h" | 27 #include "chromecast/browser/cast_browser_process.h" |
27 #include "chromecast/browser/cast_network_delegate.h" | 28 #include "chromecast/browser/cast_network_delegate.h" |
28 #include "chromecast/browser/cast_quota_permission_context.h" | 29 #include "chromecast/browser/cast_quota_permission_context.h" |
(...skipping 14 matching lines...) Expand all Loading... |
43 #include "content/public/browser/client_certificate_delegate.h" | 44 #include "content/public/browser/client_certificate_delegate.h" |
44 #include "content/public/browser/render_process_host.h" | 45 #include "content/public/browser/render_process_host.h" |
45 #include "content/public/browser/resource_dispatcher_host.h" | 46 #include "content/public/browser/resource_dispatcher_host.h" |
46 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
47 #include "content/public/common/content_descriptors.h" | 48 #include "content/public/common/content_descriptors.h" |
48 #include "content/public/common/content_switches.h" | 49 #include "content/public/common/content_switches.h" |
49 #include "content/public/common/url_constants.h" | 50 #include "content/public/common/url_constants.h" |
50 #include "content/public/common/web_preferences.h" | 51 #include "content/public/common/web_preferences.h" |
51 #include "net/ssl/ssl_cert_request_info.h" | 52 #include "net/ssl/ssl_cert_request_info.h" |
52 #include "net/url_request/url_request_context_getter.h" | 53 #include "net/url_request/url_request_context_getter.h" |
| 54 #include "ui/display/display.h" |
| 55 #include "ui/display/screen.h" |
53 #include "ui/gl/gl_switches.h" | 56 #include "ui/gl/gl_switches.h" |
54 | 57 |
55 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 58 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
56 #include "chromecast/browser/media/cast_mojo_media_client.h" | 59 #include "chromecast/browser/media/cast_mojo_media_client.h" |
57 #include "media/mojo/services/mojo_media_application.h" // nogncheck | 60 #include "media/mojo/services/mojo_media_application.h" // nogncheck |
58 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS | 61 #endif // ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS |
59 | 62 |
60 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
61 #include "components/crash/content/browser/crash_dump_manager_android.h" | 64 #include "components/crash/content/browser/crash_dump_manager_android.h" |
62 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" | 65 #include "components/external_video_surface/browser/android/external_video_surfa
ce_container_impl.h" |
(...skipping 28 matching lines...) Expand all Loading... |
91 | 94 |
92 CastContentBrowserClient::~CastContentBrowserClient() { | 95 CastContentBrowserClient::~CastContentBrowserClient() { |
93 content::BrowserThread::DeleteSoon( | 96 content::BrowserThread::DeleteSoon( |
94 content::BrowserThread::IO, | 97 content::BrowserThread::IO, |
95 FROM_HERE, | 98 FROM_HERE, |
96 url_request_context_factory_.release()); | 99 url_request_context_factory_.release()); |
97 } | 100 } |
98 | 101 |
99 void CastContentBrowserClient::AppendExtraCommandLineSwitches( | 102 void CastContentBrowserClient::AppendExtraCommandLineSwitches( |
100 base::CommandLine* command_line) { | 103 base::CommandLine* command_line) { |
| 104 std::string process_type = |
| 105 command_line->GetSwitchValueNative(switches::kProcessType); |
| 106 if (process_type == switches::kGpuProcess) { |
| 107 gfx::Size res = |
| 108 display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel(); |
| 109 if (!command_line->HasSwitch(switches::kCastInitialScreenWidth)) { |
| 110 command_line->AppendSwitchASCII(switches::kCastInitialScreenWidth, |
| 111 base::IntToString(res.width())); |
| 112 } |
| 113 if (!command_line->HasSwitch(switches::kCastInitialScreenHeight)) { |
| 114 command_line->AppendSwitchASCII(switches::kCastInitialScreenHeight, |
| 115 base::IntToString(res.height())); |
| 116 } |
| 117 } |
101 } | 118 } |
102 | 119 |
103 void CastContentBrowserClient::PreCreateThreads() { | 120 void CastContentBrowserClient::PreCreateThreads() { |
104 } | 121 } |
105 | 122 |
106 std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService( | 123 std::unique_ptr<CastService> CastContentBrowserClient::CreateCastService( |
107 content::BrowserContext* browser_context, | 124 content::BrowserContext* browser_context, |
108 PrefService* pref_service, | 125 PrefService* pref_service, |
109 net::URLRequestContextGetter* request_context_getter, | 126 net::URLRequestContextGetter* request_context_getter, |
110 media::VideoPlaneController* video_plane_controller) { | 127 media::VideoPlaneController* video_plane_controller) { |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 process_type, dumps_path, false /* upload */); | 534 process_type, dumps_path, false /* upload */); |
518 // StartUploaderThread() even though upload is diferred. | 535 // StartUploaderThread() even though upload is diferred. |
519 // Breakpad-related memory is freed in the uploader thread. | 536 // Breakpad-related memory is freed in the uploader thread. |
520 crash_handler->StartUploaderThread(); | 537 crash_handler->StartUploaderThread(); |
521 return crash_handler; | 538 return crash_handler; |
522 } | 539 } |
523 #endif // !defined(OS_ANDROID) | 540 #endif // !defined(OS_ANDROID) |
524 | 541 |
525 } // namespace shell | 542 } // namespace shell |
526 } // namespace chromecast | 543 } // namespace chromecast |
OLD | NEW |