Bunch of boilerplate to set up a process, ipc, etc.

Only hooked up in "aura_demo --viewer" right now, and doesn't actually accomplish anything other than opening a window yet.

Review URL: https://codereview.chromium.org/10872002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157367 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index 7b8f93d..b3475ed 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -27,6 +27,8 @@
 #include "base/message_pump_aurax11.h"
 #endif
 
+extern int ViewerProcessMain();
+
 namespace {
 
 // Trivial WindowDelegate implementation that draws a colored background.
@@ -118,18 +120,7 @@
   DISALLOW_COPY_AND_ASSIGN(DemoStackingClient);
 };
 
-}  // namespace
-
-int main(int argc, char** argv) {
-  CommandLine::Init(argc, argv);
-
-  // The exit manager is in charge of calling the dtors of singleton objects.
-  base::AtExitManager exit_manager;
-
-  ui::RegisterPathProvider();
-  icu_util::Initialize();
-  ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
-
+int DemoMain() {
   // Create the message-loop here before creating the root window.
   MessageLoop message_loop(MessageLoop::TYPE_UI);
   ui::CompositorTestSupport::Initialize();
@@ -171,3 +162,27 @@
 
   return 0;
 }
+
+int RunMain() {
+  // TODO(scottmg): Something not crappy.
+  if (CommandLine::ForCurrentProcess()->HasSwitch("viewer")) {
+    return ViewerProcessMain();
+  } else {
+    return DemoMain();
+  }
+}
+
+}  // namespace
+
+int main(int argc, char** argv) {
+  CommandLine::Init(argc, argv);
+
+  // The exit manager is in charge of calling the dtors of singleton objects.
+  base::AtExitManager exit_manager;
+
+  ui::RegisterPathProvider();
+  icu_util::Initialize();
+  ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
+
+  return RunMain();
+}