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/base_paths.h" | 7 #include "base/base_paths.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 "chromecast/common/cast_paths.h" | 10 #include "chromecast/common/cast_paths.h" |
| 11 #include "chromecast/common/cast_resource_delegate.h" |
11 #include "chromecast/shell/browser/cast_content_browser_client.h" | 12 #include "chromecast/shell/browser/cast_content_browser_client.h" |
12 #include "chromecast/shell/renderer/cast_content_renderer_client.h" | 13 #include "chromecast/shell/renderer/cast_content_renderer_client.h" |
13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
14 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
15 | 16 |
16 namespace chromecast { | 17 namespace chromecast { |
17 namespace shell { | 18 namespace shell { |
18 | 19 |
19 CastMainDelegate::CastMainDelegate() { | 20 CastMainDelegate::CastMainDelegate() { |
20 } | 21 } |
(...skipping 14 matching lines...) Expand all Loading... |
35 return false; | 36 return false; |
36 } | 37 } |
37 | 38 |
38 void CastMainDelegate::PreSandboxStartup() { | 39 void CastMainDelegate::PreSandboxStartup() { |
39 InitializeResourceBundle(); | 40 InitializeResourceBundle(); |
40 } | 41 } |
41 | 42 |
42 void CastMainDelegate::ZygoteForked() { | 43 void CastMainDelegate::ZygoteForked() { |
43 } | 44 } |
44 | 45 |
45 // static | |
46 void CastMainDelegate::InitializeResourceBundle() { | 46 void CastMainDelegate::InitializeResourceBundle() { |
47 base::FilePath pak_file; | 47 resource_delegate_.reset(new CastResourceDelegate()); |
| 48 // TODO(gunsch): Use LOAD_COMMON_RESOURCES once ResourceBundle no longer |
| 49 // hardcodes resource file names. |
| 50 ui::ResourceBundle::InitSharedInstanceWithLocale( |
| 51 "en-US", |
| 52 resource_delegate_.get(), |
| 53 ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES); |
| 54 |
48 base::FilePath pak_dir; | 55 base::FilePath pak_dir; |
49 | |
50 PathService::Get(base::DIR_MODULE, &pak_dir); | 56 PathService::Get(base::DIR_MODULE, &pak_dir); |
51 | 57 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
52 pak_file = pak_dir.Append(FILE_PATH_LITERAL("cast_shell.pak")); | 58 pak_dir.Append(FILE_PATH_LITERAL("cast_shell.pak")), |
53 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); | 59 ui::SCALE_FACTOR_NONE); |
54 } | 60 } |
55 | 61 |
56 content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { | 62 content::ContentBrowserClient* CastMainDelegate::CreateContentBrowserClient() { |
57 browser_client_.reset(new CastContentBrowserClient); | 63 browser_client_.reset(new CastContentBrowserClient); |
58 return browser_client_.get(); | 64 return browser_client_.get(); |
59 } | 65 } |
60 | 66 |
61 content::ContentRendererClient* | 67 content::ContentRendererClient* |
62 CastMainDelegate::CreateContentRendererClient() { | 68 CastMainDelegate::CreateContentRendererClient() { |
63 renderer_client_.reset(new CastContentRendererClient); | 69 renderer_client_.reset(new CastContentRendererClient); |
64 return renderer_client_.get(); | 70 return renderer_client_.get(); |
65 } | 71 } |
66 | 72 |
67 } // namespace shell | 73 } // namespace shell |
68 } // namespace chromecast | 74 } // namespace chromecast |
OLD | NEW |