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/app/cast_main_delegate.h" | 5 #include "chromecast/shell/app/cast_main_delegate.h" |
6 | 6 |
7 #include "base/cpu.h" | 7 #include "base/cpu.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/posix/global_descriptors.h" | 10 #include "base/posix/global_descriptors.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // the file system. Use the file descriptor passed in at launch time. | 86 // the file system. Use the file descriptor passed in at launch time. |
87 int pak_fd = | 87 int pak_fd = |
88 base::GlobalDescriptors::GetInstance()->MaybeGet(kAndroidPakDescriptor); | 88 base::GlobalDescriptors::GetInstance()->MaybeGet(kAndroidPakDescriptor); |
89 if (pak_fd >= 0) { | 89 if (pak_fd >= 0) { |
90 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 90 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
91 base::File(pak_fd), base::MemoryMappedFile::Region::kWholeFile); | 91 base::File(pak_fd), base::MemoryMappedFile::Region::kWholeFile); |
92 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 92 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
93 base::File(pak_fd), ui::SCALE_FACTOR_100P); | 93 base::File(pak_fd), ui::SCALE_FACTOR_100P); |
94 return; | 94 return; |
95 } | 95 } |
96 #endif | 96 #endif // defined(OS_ANDROID) |
97 | 97 |
98 resource_delegate_.reset(new CastResourceDelegate()); | 98 resource_delegate_.reset(new CastResourceDelegate()); |
99 // TODO(gunsch): Use LOAD_COMMON_RESOURCES once ResourceBundle no longer | 99 // TODO(gunsch): Use LOAD_COMMON_RESOURCES once ResourceBundle no longer |
100 // hardcodes resource file names. | 100 // hardcodes resource file names. |
101 ui::ResourceBundle::InitSharedInstanceWithLocale( | 101 ui::ResourceBundle::InitSharedInstanceWithLocale( |
102 "en-US", | 102 "en-US", |
103 resource_delegate_.get(), | 103 resource_delegate_.get(), |
104 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); | 104 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); |
105 | 105 |
106 base::FilePath pak_file; | 106 base::FilePath pak_file; |
107 CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); | 107 CHECK(PathService::Get(FILE_CAST_PAK, &pak_file)); |
108 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 108 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
109 pak_file, | 109 pak_file, |
110 ui::SCALE_FACTOR_NONE); | 110 ui::SCALE_FACTOR_NONE); |
111 } | 111 } |
112 | 112 |
113 content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { | 113 content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { |
114 browser_client_.reset(new CastContentBrowserClient); | 114 browser_client_.reset(new CastContentBrowserClient); |
115 return browser_client_.get(); | 115 return browser_client_.get(); |
116 } | 116 } |
117 | 117 |
118 content::ContentRendererClient* | 118 content::ContentRendererClient* |
119 CastMainDelegate::CreateContentRendererClient() { | 119 CastMainDelegate::CreateContentRendererClient() { |
120 renderer_client_.reset(new CastContentRendererClient); | 120 renderer_client_.reset(new CastContentRendererClient); |
121 return renderer_client_.get(); | 121 return renderer_client_.get(); |
122 } | 122 } |
123 | 123 |
124 } // namespace shell | 124 } // namespace shell |
125 } // namespace chromecast | 125 } // namespace chromecast |
OLD | NEW |