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 "extensions/shell/app/shell_main_delegate.h" |
6 | 6 |
7 #include "apps/shell/browser/default_shell_browser_main_delegate.h" | |
8 #include "apps/shell/browser/shell_content_browser_client.h" | |
9 #include "apps/shell/common/shell_content_client.h" | |
10 #include "apps/shell/renderer/shell_content_renderer_client.h" | |
11 #include "apps/shell/renderer/shell_renderer_main_delegate.h" | |
12 #include "base/command_line.h" | 7 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
14 #include "base/logging.h" | 9 #include "base/logging.h" |
15 #include "base/path_service.h" | 10 #include "base/path_service.h" |
16 #include "content/public/browser/browser_main_runner.h" | 11 #include "content/public/browser/browser_main_runner.h" |
17 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
18 #include "extensions/common/extension_paths.h" | 13 #include "extensions/common/extension_paths.h" |
| 14 #include "extensions/shell/browser/default_shell_browser_main_delegate.h" |
| 15 #include "extensions/shell/browser/shell_content_browser_client.h" |
| 16 #include "extensions/shell/common/shell_content_client.h" |
| 17 #include "extensions/shell/renderer/shell_content_renderer_client.h" |
| 18 #include "extensions/shell/renderer/shell_renderer_main_delegate.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 | 20 |
21 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
22 #include "chromeos/chromeos_paths.h" | 22 #include "chromeos/chromeos_paths.h" |
23 #endif | 23 #endif |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 void InitLogging() { | 27 void InitLogging() { |
28 base::FilePath log_filename; | 28 base::FilePath log_filename; |
29 PathService::Get(base::DIR_EXE, &log_filename); | 29 PathService::Get(base::DIR_EXE, &log_filename); |
30 log_filename = log_filename.AppendASCII("app_shell.log"); | 30 log_filename = log_filename.AppendASCII("app_shell.log"); |
31 logging::LoggingSettings settings; | 31 logging::LoggingSettings settings; |
32 settings.logging_dest = logging::LOG_TO_ALL; | 32 settings.logging_dest = logging::LOG_TO_ALL; |
33 settings.log_file = log_filename.value().c_str(); | 33 settings.log_file = log_filename.value().c_str(); |
34 settings.delete_old = logging::DELETE_OLD_LOG_FILE; | 34 settings.delete_old = logging::DELETE_OLD_LOG_FILE; |
35 logging::InitLogging(settings); | 35 logging::InitLogging(settings); |
36 logging::SetLogItems(true, true, true, true); | 36 logging::SetLogItems(true, true, true, true); |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 namespace apps { | 41 namespace extensions { |
42 | 42 |
43 ShellMainDelegate::ShellMainDelegate() { | 43 ShellMainDelegate::ShellMainDelegate() { |
44 } | 44 } |
45 | 45 |
46 ShellMainDelegate::~ShellMainDelegate() { | 46 ShellMainDelegate::~ShellMainDelegate() { |
47 } | 47 } |
48 | 48 |
49 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { | 49 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { |
50 InitLogging(); | 50 InitLogging(); |
51 content_client_.reset(new ShellContentClient); | 51 content_client_.reset(new ShellContentClient); |
(...skipping 14 matching lines...) Expand all Loading... |
66 InitializeResourceBundle(); | 66 InitializeResourceBundle(); |
67 } | 67 } |
68 | 68 |
69 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 69 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
70 browser_client_.reset(CreateShellContentBrowserClient()); | 70 browser_client_.reset(CreateShellContentBrowserClient()); |
71 return browser_client_.get(); | 71 return browser_client_.get(); |
72 } | 72 } |
73 | 73 |
74 content::ContentBrowserClient* | 74 content::ContentBrowserClient* |
75 ShellMainDelegate::CreateShellContentBrowserClient() { | 75 ShellMainDelegate::CreateShellContentBrowserClient() { |
76 return new apps::ShellContentBrowserClient( | 76 return new ShellContentBrowserClient(new DefaultShellBrowserMainDelegate()); |
77 new DefaultShellBrowserMainDelegate()); | |
78 } | 77 } |
79 | 78 |
80 content::ContentRendererClient* | 79 content::ContentRendererClient* |
81 ShellMainDelegate::CreateContentRendererClient() { | 80 ShellMainDelegate::CreateContentRendererClient() { |
82 renderer_client_.reset( | 81 renderer_client_.reset( |
83 new ShellContentRendererClient(CreateShellRendererMainDelegate())); | 82 new ShellContentRendererClient(CreateShellRendererMainDelegate())); |
84 return renderer_client_.get(); | 83 return renderer_client_.get(); |
85 } | 84 } |
86 | 85 |
87 scoped_ptr<ShellRendererMainDelegate> | 86 scoped_ptr<ShellRendererMainDelegate> |
(...skipping 12 matching lines...) Expand all Loading... |
100 bool ShellMainDelegate::ProcessNeedsResourceBundle( | 99 bool ShellMainDelegate::ProcessNeedsResourceBundle( |
101 const std::string& process_type) { | 100 const std::string& process_type) { |
102 // The browser process has no process type flag, but needs resources. | 101 // The browser process has no process type flag, but needs resources. |
103 // On Linux the zygote process opens the resources for the renderers. | 102 // On Linux the zygote process opens the resources for the renderers. |
104 return process_type.empty() || | 103 return process_type.empty() || |
105 process_type == switches::kZygoteProcess || | 104 process_type == switches::kZygoteProcess || |
106 process_type == switches::kRendererProcess || | 105 process_type == switches::kRendererProcess || |
107 process_type == switches::kUtilityProcess; | 106 process_type == switches::kUtilityProcess; |
108 } | 107 } |
109 | 108 |
110 } // namespace apps | 109 } // namespace extensions |
OLD | NEW |