OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/shell/app/shell_main_delegate.h" | 5 #include "apps/shell/app/shell_main_delegate.h" |
6 | 6 |
7 #include "apps/shell/browser/shell_content_browser_client.h" | 7 #include "apps/shell/browser/shell_content_browser_client.h" |
8 #include "apps/shell/common/shell_content_client.h" | 8 #include "apps/shell/common/shell_content_client.h" |
9 #include "apps/shell/renderer/shell_content_renderer_client.h" | 9 #include "apps/shell/renderer/shell_content_renderer_client.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 settings.log_file = log_filename.value().c_str(); | 31 settings.log_file = log_filename.value().c_str(); |
32 settings.delete_old = logging::DELETE_OLD_LOG_FILE; | 32 settings.delete_old = logging::DELETE_OLD_LOG_FILE; |
33 logging::InitLogging(settings); | 33 logging::InitLogging(settings); |
34 logging::SetLogItems(true, true, true, true); | 34 logging::SetLogItems(true, true, true, true); |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 namespace apps { | 39 namespace apps { |
40 | 40 |
41 ShellMainDelegate::ShellMainDelegate() { | 41 ShellMainDelegate::ShellMainDelegate( |
| 42 ShellBrowserMainDelegate* browser_main_delegate) { |
| 43 browser_client_.reset( |
| 44 new apps::ShellContentBrowserClient(browser_main_delegate)); |
42 } | 45 } |
43 | 46 |
44 ShellMainDelegate::~ShellMainDelegate() { | 47 ShellMainDelegate::~ShellMainDelegate() { |
45 } | 48 } |
46 | 49 |
47 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 50 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
48 InitLogging(); | 51 InitLogging(); |
49 content_client_.reset(new ShellContentClient); | 52 content_client_.reset(new ShellContentClient); |
50 SetContentClient(content_client_.get()); | 53 SetContentClient(content_client_.get()); |
51 | 54 |
52 #if defined(OS_CHROMEOS) | 55 #if defined(OS_CHROMEOS) |
53 chromeos::RegisterPathProvider(); | 56 chromeos::RegisterPathProvider(); |
54 #endif | 57 #endif |
55 extensions::RegisterPathProvider(); | 58 extensions::RegisterPathProvider(); |
56 return false; | 59 return false; |
57 } | 60 } |
58 | 61 |
59 void ShellMainDelegate::PreSandboxStartup() { | 62 void ShellMainDelegate::PreSandboxStartup() { |
60 std::string process_type = | 63 std::string process_type = |
61 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 64 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
62 switches::kProcessType); | 65 switches::kProcessType); |
63 if (ProcessNeedsResourceBundle(process_type)) | 66 if (ProcessNeedsResourceBundle(process_type)) |
64 InitializeResourceBundle(); | 67 InitializeResourceBundle(); |
65 } | 68 } |
66 | 69 |
67 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 70 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
68 browser_client_.reset(new apps::ShellContentBrowserClient); | |
69 return browser_client_.get(); | 71 return browser_client_.get(); |
70 } | 72 } |
71 | 73 |
72 content::ContentRendererClient* | 74 content::ContentRendererClient* |
73 ShellMainDelegate::CreateContentRendererClient() { | 75 ShellMainDelegate::CreateContentRendererClient() { |
74 renderer_client_.reset(new ShellContentRendererClient); | 76 renderer_client_.reset(new ShellContentRendererClient); |
75 return renderer_client_.get(); | 77 return renderer_client_.get(); |
76 } | 78 } |
77 | 79 |
78 // static | 80 // static |
79 bool ShellMainDelegate::ProcessNeedsResourceBundle( | 81 bool ShellMainDelegate::ProcessNeedsResourceBundle( |
80 const std::string& process_type) { | 82 const std::string& process_type) { |
81 // The browser process has no process type flag, but needs resources. | 83 // The browser process has no process type flag, but needs resources. |
82 // On Linux the zygote process opens the resources for the renderers. | 84 // On Linux the zygote process opens the resources for the renderers. |
83 return process_type.empty() || | 85 return process_type.empty() || |
84 process_type == switches::kZygoteProcess || | 86 process_type == switches::kZygoteProcess || |
85 process_type == switches::kRendererProcess || | 87 process_type == switches::kRendererProcess || |
86 process_type == switches::kUtilityProcess; | 88 process_type == switches::kUtilityProcess; |
87 } | 89 } |
88 | 90 |
89 void ShellMainDelegate::InitializeResourceBundle() { | 91 void ShellMainDelegate::InitializeResourceBundle() { |
90 base::FilePath pak_dir; | 92 base::FilePath pak_dir; |
91 PathService::Get(base::DIR_MODULE, &pak_dir); | 93 PathService::Get(base::DIR_MODULE, &pak_dir); |
92 ui::ResourceBundle::InitSharedInstanceWithPakPath( | 94 ui::ResourceBundle::InitSharedInstanceWithPakPath( |
93 pak_dir.AppendASCII("app_shell.pak")); | 95 pak_dir.AppendASCII("app_shell.pak")); |
94 } | 96 } |
95 | 97 |
96 } // namespace apps | 98 } // namespace apps |
OLD | NEW |