Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: apps/shell/app/shell_main_delegate.cc

Issue 270763002: Minimal athena shell main (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(StartCallback* start_callback) {
42 browser_client_.reset(new apps::ShellContentBrowserClient(start_callback));
42 } 43 }
43 44
44 ShellMainDelegate::~ShellMainDelegate() { 45 ShellMainDelegate::~ShellMainDelegate() {
45 } 46 }
46 47
47 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { 48 bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
48 InitLogging(); 49 InitLogging();
49 content_client_.reset(new ShellContentClient); 50 content_client_.reset(new ShellContentClient);
50 SetContentClient(content_client_.get()); 51 SetContentClient(content_client_.get());
51 52
52 #if defined(OS_CHROMEOS) 53 #if defined(OS_CHROMEOS)
53 chromeos::RegisterPathProvider(); 54 chromeos::RegisterPathProvider();
54 #endif 55 #endif
55 extensions::RegisterPathProvider(); 56 extensions::RegisterPathProvider();
56 return false; 57 return false;
57 } 58 }
58 59
59 void ShellMainDelegate::PreSandboxStartup() { 60 void ShellMainDelegate::PreSandboxStartup() {
60 std::string process_type = 61 std::string process_type =
61 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 62 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
62 switches::kProcessType); 63 switches::kProcessType);
63 if (ProcessNeedsResourceBundle(process_type)) 64 if (ProcessNeedsResourceBundle(process_type))
64 InitializeResourceBundle(); 65 InitializeResourceBundle();
65 } 66 }
66 67
67 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { 68 content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {
68 browser_client_.reset(new apps::ShellContentBrowserClient);
69 return browser_client_.get(); 69 return browser_client_.get();
70 } 70 }
71 71
72 content::ContentRendererClient* 72 content::ContentRendererClient*
73 ShellMainDelegate::CreateContentRendererClient() { 73 ShellMainDelegate::CreateContentRendererClient() {
74 renderer_client_.reset(new ShellContentRendererClient); 74 renderer_client_.reset(new ShellContentRendererClient);
75 return renderer_client_.get(); 75 return renderer_client_.get();
76 } 76 }
77 77
78 // static 78 // static
79 bool ShellMainDelegate::ProcessNeedsResourceBundle( 79 bool ShellMainDelegate::ProcessNeedsResourceBundle(
80 const std::string& process_type) { 80 const std::string& process_type) {
81 // The browser process has no process type flag, but needs resources. 81 // The browser process has no process type flag, but needs resources.
82 // On Linux the zygote process opens the resources for the renderers. 82 // On Linux the zygote process opens the resources for the renderers.
83 return process_type.empty() || 83 return process_type.empty() ||
84 process_type == switches::kZygoteProcess || 84 process_type == switches::kZygoteProcess ||
85 process_type == switches::kRendererProcess || 85 process_type == switches::kRendererProcess ||
86 process_type == switches::kUtilityProcess; 86 process_type == switches::kUtilityProcess;
87 } 87 }
88 88
89 void ShellMainDelegate::InitializeResourceBundle() { 89 void ShellMainDelegate::InitializeResourceBundle() {
90 base::FilePath pak_dir; 90 base::FilePath pak_dir;
91 PathService::Get(base::DIR_MODULE, &pak_dir); 91 PathService::Get(base::DIR_MODULE, &pak_dir);
92 ui::ResourceBundle::InitSharedInstanceWithPakPath( 92 ui::ResourceBundle::InitSharedInstanceWithPakPath(
93 pak_dir.AppendASCII("app_shell.pak")); 93 pak_dir.AppendASCII("app_shell.pak"));
94 } 94 }
95 95
96 } // namespace apps 96 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698