summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 00:44:14 +0000
committermichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 00:44:14 +0000
commite5df69d4c55438249f0c7e32d9efb6a63181b440 (patch)
tree3c37ddb46bb2bdab0a882b33e42cdb6b7ef65ad4
parent5a073091c79e3d46a522edbcd4a7565b7d8505e5 (diff)
downloadchromium_src-e5df69d4c55438249f0c7e32d9efb6a63181b440.zip
chromium_src-e5df69d4c55438249f0c7e32d9efb6a63181b440.tar.gz
chromium_src-e5df69d4c55438249f0c7e32d9efb6a63181b440.tar.bz2
- Removed the message loop from shell_browser_main_parts.cc. We don't need
that code as the message loop will be initialized by BrowserMainRunner. - Cleared the unused code in shell_browser_main.cc BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10536018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141134 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/app/content_main_runner.cc8
-rw-r--r--content/browser/browser_main_loop.cc5
-rw-r--r--content/shell/shell_browser_main.cc8
-rw-r--r--content/shell/shell_browser_main_parts.cc13
-rw-r--r--content/shell/shell_main_delegate.cc13
-rw-r--r--content/shell/shell_main_delegate.h8
6 files changed, 32 insertions, 23 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 49b5bfc..ad4244a 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -357,6 +357,14 @@ int RunNamedProcessTypeMain(
if (delegate) {
int exit_code = delegate->RunProcess(process_type,
main_function_params);
+#if defined(OS_ANDROID)
+ // In Android's browser process, the negative exit code doesn't mean the
+ // default behavior should be used as the UI message loop is managed by
+ // the Java and the browser process's default behavior is always
+ // overridden.
+ if (process_type.empty())
+ return exit_code;
+#endif
if (exit_code >= 0)
return exit_code;
}
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 3007157..635c203 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -321,8 +321,11 @@ void BrowserMainLoop::MainMessageLoopStart() {
system_monitor_.reset(new base::SystemMonitor);
hi_res_timer_manager_.reset(new HighResolutionTimerManager);
-
+#if !defined(OS_ANDROID)
+ // TODO(michaelbai): The Android content shell was stuck here, disabled it
+ // temporarily.
network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
+#endif
audio_manager_.reset(media::AudioManager::Create());
online_state_observer_.reset(new BrowserOnlineStateObserver);
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc
index 01c68e3..f56af33 100644
--- a/content/shell/shell_browser_main.cc
+++ b/content/shell/shell_browser_main.cc
@@ -59,13 +59,6 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) {
int exit_code = main_runner_->Initialize(parameters);
-#if defined(OS_ANDROID)
- DCHECK(exit_code < 0);
-
- // Return 0 so that we do NOT trigger the default behavior. On Android, the
- // UI message loop is managed by the Java application.
- return 0;
-#else
if (exit_code >= 0)
return exit_code;
@@ -115,5 +108,4 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters) {
main_runner_->Shutdown();
return exit_code;
-#endif
}
diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc
index 945c4e0..a758ca9 100644
--- a/content/shell/shell_browser_main_parts.cc
+++ b/content/shell/shell_browser_main_parts.cc
@@ -18,10 +18,6 @@
#include "googleurl/src/gurl.h"
#include "net/base/net_module.h"
-#if defined(OS_ANDROID)
-#include "base/message_pump_android.h"
-#endif
-
namespace content {
static GURL GetStartupURL() {
@@ -33,12 +29,6 @@ static GURL GetStartupURL() {
return GURL(args[0]);
}
-#if defined(OS_ANDROID)
-static base::MessagePump* CreateMessagePumpForShell() {
- return new base::MessagePumpForUI();
-}
-#endif
-
ShellBrowserMainParts::ShellBrowserMainParts(
const content::MainFunctionParams& parameters)
: BrowserMainParts(),
@@ -50,9 +40,6 @@ ShellBrowserMainParts::~ShellBrowserMainParts() {
#if !defined(OS_MACOSX)
void ShellBrowserMainParts::PreMainMessageLoopStart() {
-#if defined(OS_ANDROID)
- MessageLoopForUI::InitMessagePumpForUIFactory(&CreateMessagePumpForShell);
-#endif
}
#endif
diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc
index f2ae251..05516c6 100644
--- a/content/shell/shell_main_delegate.cc
+++ b/content/shell/shell_main_delegate.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/path_service.h"
+#include "content/public/browser/browser_main_runner.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/shell/shell_browser_main.h"
@@ -46,10 +47,20 @@ void ShellMainDelegate::PreSandboxStartup() {
int ShellMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
- if (process_type != "")
+ if (!process_type.empty())
return -1;
+#if !defined(OS_ANDROID)
return ShellBrowserMain(main_function_params);
+#else
+ // If no process type is specified, we are creating the main browser process.
+ browser_runner_.reset(content::BrowserMainRunner::Create());
+ int exit_code = browser_runner_->Initialize(main_function_params);
+ DCHECK(exit_code < 0)
+ << "BrowserRunner::Initialize failed in ShellMainDelegate";
+
+ return exit_code;
+#endif
}
void ShellMainDelegate::InitializeResourceBundle() {
diff --git a/content/shell/shell_main_delegate.h b/content/shell/shell_main_delegate.h
index a36dbcc..04697b7 100644
--- a/content/shell/shell_main_delegate.h
+++ b/content/shell/shell_main_delegate.h
@@ -14,6 +14,10 @@
namespace content {
class ShellContentBrowserClient;
class ShellContentRendererClient;
+
+#if defined(OS_ANDROID)
+class BrowserMainRunner;
+#endif
} // namespace content
class ShellMainDelegate : public content::ContentMainDelegate {
@@ -38,6 +42,10 @@ class ShellMainDelegate : public content::ContentMainDelegate {
scoped_ptr<content::ShellContentRendererClient> renderer_client_;
content::ShellContentClient content_client_;
+#if defined(OS_ANDROID)
+ scoped_ptr<content::BrowserMainRunner> browser_runner_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate);
};