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

Unified Diff: apps/shell/shell_main_delegate.cc

Issue 149163002: app_shell: Add ShellContentRendererClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (content_renderer_client) Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « apps/shell/shell_main_delegate.h ('k') | extensions/common/extensions_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/shell/shell_main_delegate.cc
diff --git a/apps/shell/shell_main_delegate.cc b/apps/shell/shell_main_delegate.cc
index 2406ca97786017b432098b2cb42f68a66e930a3f..23c91faa9a45ab1bf06552492102f64b43a7bfdf 100644
--- a/apps/shell/shell_main_delegate.cc
+++ b/apps/shell/shell_main_delegate.cc
@@ -4,15 +4,23 @@
#include "apps/shell/shell_main_delegate.h"
+#include "apps/shell/renderer/shell_content_renderer_client.h"
#include "apps/shell/shell_content_browser_client.h"
#include "apps/shell/shell_content_client.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
+#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_main_runner.h"
+#include "content/public/common/content_switches.h"
+#include "extensions/common/extension_paths.h"
#include "ui/base/resource/resource_bundle.h"
+#if defined(OS_CHROMEOS)
+#include "chromeos/chromeos_paths.h"
+#endif
+
namespace {
void InitLogging() {
@@ -41,11 +49,21 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
InitLogging();
content_client_.reset(new ShellContentClient);
SetContentClient(content_client_.get());
+
+ chrome::RegisterPathProvider();
+#if defined(OS_CHROMEOS)
+ chromeos::RegisterPathProvider();
+#endif
+ extensions::RegisterPathProvider();
return false;
}
void ShellMainDelegate::PreSandboxStartup() {
- InitializeResourceBundle();
+ std::string process_type =
+ CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kProcessType);
+ if (ProcessNeedsResourceBundle(process_type))
+ InitializeResourceBundle();
}
content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {
@@ -55,13 +73,30 @@ content::ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() {
content::ContentRendererClient*
ShellMainDelegate::CreateContentRendererClient() {
- // TODO(jamescook): Create a ShellContentRendererClient with the extensions
- // initialization pieces of ChromeContentRendererClient.
- return content::ContentMainDelegate::CreateContentRendererClient();
+ renderer_client_.reset(new ShellContentRendererClient);
+ return renderer_client_.get();
+}
+
+// static
+bool ShellMainDelegate::ProcessNeedsResourceBundle(
+ const std::string& process_type) {
+ // The browser process has no process type flag, but needs resources.
+ // On Linux the zygote process opens the resources for the renderers.
+ return process_type.empty() ||
+ process_type == switches::kZygoteProcess ||
+ process_type == switches::kRendererProcess ||
+ process_type == switches::kUtilityProcess;
}
void ShellMainDelegate::InitializeResourceBundle() {
ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
+
+ // The extensions system needs manifest data from the Chrome PAK file.
+ // TODO(jamescook): app_shell needs its own manifest data file.
+ base::FilePath resources_pack_path;
+ PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
+ ResourceBundle::GetSharedInstance().AddDataPackFromPath(
+ resources_pack_path, ui::SCALE_FACTOR_NONE);
}
} // namespace apps
« no previous file with comments | « apps/shell/shell_main_delegate.h ('k') | extensions/common/extensions_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698