| 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/default_shell_browser_main_delegate.h" | 7 #include "apps/shell/browser/default_shell_browser_main_delegate.h" |
| 8 #include "apps/shell/browser/shell_content_browser_client.h" | 8 #include "apps/shell/browser/shell_content_browser_client.h" |
| 9 #include "apps/shell/common/shell_content_client.h" | 9 #include "apps/shell/common/shell_content_client.h" |
| 10 #include "apps/shell/renderer/shell_content_renderer_client.h" | 10 #include "apps/shell/renderer/shell_content_renderer_client.h" |
| 11 #include "apps/shell/renderer/shell_renderer_main_delegate.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 15 #include "content/public/browser/browser_main_runner.h" | 16 #include "content/public/browser/browser_main_runner.h" |
| 16 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 17 #include "extensions/common/extension_paths.h" | 18 #include "extensions/common/extension_paths.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
| 19 | 20 |
| 20 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 67 } |
| 67 | 68 |
| 68 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 69 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
| 69 browser_client_.reset( | 70 browser_client_.reset( |
| 70 new apps::ShellContentBrowserClient(CreateShellBrowserMainDelegate())); | 71 new apps::ShellContentBrowserClient(CreateShellBrowserMainDelegate())); |
| 71 return browser_client_.get(); | 72 return browser_client_.get(); |
| 72 } | 73 } |
| 73 | 74 |
| 74 content::ContentRendererClient* | 75 content::ContentRendererClient* |
| 75 ShellMainDelegate::CreateContentRendererClient() { | 76 ShellMainDelegate::CreateContentRendererClient() { |
| 76 renderer_client_.reset(new ShellContentRendererClient); | 77 renderer_client_.reset( |
| 78 new ShellContentRendererClient(CreateShellRendererMainDelegate())); |
| 77 return renderer_client_.get(); | 79 return renderer_client_.get(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 ShellBrowserMainDelegate* ShellMainDelegate::CreateShellBrowserMainDelegate() { | 82 ShellBrowserMainDelegate* ShellMainDelegate::CreateShellBrowserMainDelegate() { |
| 81 return new DefaultShellBrowserMainDelegate(); | 83 return new DefaultShellBrowserMainDelegate(); |
| 82 } | 84 } |
| 83 | 85 |
| 86 scoped_ptr<ShellRendererMainDelegate> |
| 87 ShellMainDelegate::CreateShellRendererMainDelegate() { |
| 88 return scoped_ptr<ShellRendererMainDelegate>(); |
| 89 } |
| 90 |
| 84 // static | 91 // static |
| 85 bool ShellMainDelegate::ProcessNeedsResourceBundle( | 92 bool ShellMainDelegate::ProcessNeedsResourceBundle( |
| 86 const std::string& process_type) { | 93 const std::string& process_type) { |
| 87 // The browser process has no process type flag, but needs resources. | 94 // The browser process has no process type flag, but needs resources. |
| 88 // On Linux the zygote process opens the resources for the renderers. | 95 // On Linux the zygote process opens the resources for the renderers. |
| 89 return process_type.empty() || | 96 return process_type.empty() || |
| 90 process_type == switches::kZygoteProcess || | 97 process_type == switches::kZygoteProcess || |
| 91 process_type == switches::kRendererProcess || | 98 process_type == switches::kRendererProcess || |
| 92 process_type == switches::kUtilityProcess; | 99 process_type == switches::kUtilityProcess; |
| 93 } | 100 } |
| 94 | 101 |
| 95 void ShellMainDelegate::InitializeResourceBundle() { | 102 void ShellMainDelegate::InitializeResourceBundle() { |
| 96 base::FilePath pak_dir; | 103 base::FilePath pak_dir; |
| 97 PathService::Get(base::DIR_MODULE, &pak_dir); | 104 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 98 ui::ResourceBundle::InitSharedInstanceWithPakPath( | 105 ui::ResourceBundle::InitSharedInstanceWithPakPath( |
| 99 pak_dir.AppendASCII("app_shell.pak")); | 106 pak_dir.AppendASCII("app_shell.pak")); |
| 100 } | 107 } |
| 101 | 108 |
| 102 } // namespace apps | 109 } // namespace apps |
| OLD | NEW |