summaryrefslogtreecommitdiffstats
path: root/win8
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 07:49:58 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 07:49:58 +0000
commit8c2f290e2e178336ab89a01d94ebba774152a6f5 (patch)
tree802bf45a7853f72013d55fb1578d099240c4132b /win8
parentae30caa256bbcf0b80af9f41d803320874c2ac0f (diff)
downloadchromium_src-8c2f290e2e178336ab89a01d94ebba774152a6f5.zip
chromium_src-8c2f290e2e178336ab89a01d94ebba774152a6f5.tar.gz
chromium_src-8c2f290e2e178336ab89a01d94ebba774152a6f5.tar.bz2
Make the browser<-->metro_viewer IPC channel name a constant instead of hardcoding it in a few places and passing it via a flag.
Supporting a more generic use case via flags was making things more complicated for no apparent reason (other than perhaps one day supporting a random-channel-id -- I removed that TODO in this CL). This simplification will make it easier to introduce some sort of --viewer-launch-via-appid-and-connect flag for https://codereview.chromium.org/16022003/ BUG=179830 TEST=Can still launch Ash in Metro. Review URL: https://chromiumcodereview.appspot.com/15731003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r--win8/delegate_execute/command_execute_impl.cc8
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc12
-rw-r--r--win8/metro_driver/metro_driver.gyp3
-rw-r--r--win8/viewer/metro_viewer_constants.cc11
-rw-r--r--win8/viewer/metro_viewer_constants.h16
-rw-r--r--win8/viewer/metro_viewer_process_host.cc4
-rw-r--r--win8/viewer/metro_viewer_process_host.h17
-rw-r--r--win8/win8.gyp2
8 files changed, 49 insertions, 24 deletions
diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc
index 3d56344..03fb4da 100644
--- a/win8/delegate_execute/command_execute_impl.cc
+++ b/win8/delegate_execute/command_execute_impl.cc
@@ -59,6 +59,7 @@ HRESULT GetUrlFromShellItem(IShellItem* shell_item, string16* url) {
return S_OK;
}
+#if defined(USE_AURA)
bool LaunchChromeBrowserProcess() {
base::FilePath delegate_exe_path;
if (!PathService::Get(base::FILE_EXE, &delegate_exe_path))
@@ -88,16 +89,15 @@ bool LaunchChromeBrowserProcess() {
// Prevent a Chrome window from showing up on the desktop.
cl.AppendSwitch(switches::kSilentLaunch);
- // Tell Chrome the IPC channel name to use.
- // TODO(robertshield): Figure out how to get this name to both the launched
- // desktop browser process and the resulting activated metro process.
- cl.AppendSwitchASCII(switches::kViewerConnection, "viewer");
+ // Tell Chrome to connect to the Metro viewer process.
+ cl.AppendSwitch(switches::kViewerConnect);
base::LaunchOptions launch_options;
launch_options.start_hidden = true;
return base::LaunchProcess(cl, launch_options, NULL);
}
+#endif // defined(USE_AURA)
} // namespace
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 530d62c..87ac885 100644
--- a/win8/metro_driver/chrome_app_view_ash.cc
+++ b/win8/metro_driver/chrome_app_view_ash.cc
@@ -26,6 +26,7 @@
#include "win8/metro_driver/file_picker_ash.h"
#include "win8/metro_driver/metro_driver.h"
#include "win8/metro_driver/winrt_utils.h"
+#include "win8/viewer/metro_viewer_constants.h"
typedef winfoundtn::ITypedEventHandler<
winapp::Core::CoreApplicationView*,
@@ -432,20 +433,13 @@ ChromeAppViewAsh::Run() {
options.message_loop_type = base::MessageLoop::TYPE_IO;
io_thread.StartWithOptions(options);
- std::string ipc_channel_name("viewer");
-
- // TODO(robertshield): Figure out how to receive and append the channel ID
- // from the delegate_execute instance that launched the browser process.
- // See http://crbug.com/162474
- // ipc_channel_name.append(IPC::Channel::GenerateUniqueRandomChannelID());
-
// Start up Chrome and wait for the desired IPC server connection to exist.
- WaitForChromeIPCConnection(ipc_channel_name);
+ WaitForChromeIPCConnection(win8::kMetroViewerIPCChannelName);
// In Aura mode we create an IPC channel to the browser, then ask it to
// connect to us.
ChromeChannelListener ui_channel_listener(&ui_loop_, this);
- IPC::ChannelProxy ui_channel(ipc_channel_name,
+ IPC::ChannelProxy ui_channel(win8::kMetroViewerIPCChannelName,
IPC::Channel::MODE_NAMED_CLIENT,
&ui_channel_listener,
io_thread.message_loop_proxy());
diff --git a/win8/metro_driver/metro_driver.gyp b/win8/metro_driver/metro_driver.gyp
index bad7c79..483d7d9 100644
--- a/win8/metro_driver/metro_driver.gyp
+++ b/win8/metro_driver/metro_driver.gyp
@@ -72,6 +72,9 @@
],
'conditions': [
['use_aura==1', {
+ 'dependencies': [
+ '../win8.gyp:metro_viewer',
+ ],
'sources': [
'chrome_app_view_ash.cc',
'chrome_app_view_ash.h',
diff --git a/win8/viewer/metro_viewer_constants.cc b/win8/viewer/metro_viewer_constants.cc
new file mode 100644
index 0000000..578b22f
--- /dev/null
+++ b/win8/viewer/metro_viewer_constants.cc
@@ -0,0 +1,11 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "win8/viewer/metro_viewer_constants.h"
+
+namespace win8 {
+
+const char kMetroViewerIPCChannelName[] = "viewer";
+
+} // namespace win8
diff --git a/win8/viewer/metro_viewer_constants.h b/win8/viewer/metro_viewer_constants.h
new file mode 100644
index 0000000..249f96c
--- /dev/null
+++ b/win8/viewer/metro_viewer_constants.h
@@ -0,0 +1,16 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WIN8_VIEWER_METRO_VIEWER_CONSTANTS_H_
+#define WIN8_VIEWER_METRO_VIEWER_CONSTANTS_H_
+
+namespace win8 {
+
+// The name of the IPC channel between the browser process and the metro viewer
+// process.
+extern const char kMetroViewerIPCChannelName[];
+
+} // namespace win8
+
+#endif // WIN8_VIEWER_METRO_VIEWER_CONSTANTS_H_
diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc
index b04fa21..512f14b 100644
--- a/win8/viewer/metro_viewer_process_host.cc
+++ b/win8/viewer/metro_viewer_process_host.cc
@@ -19,6 +19,7 @@
#include "ipc/ipc_message_macros.h"
#include "ui/aura/remote_root_window_host_win.h"
#include "ui/metro_viewer/metro_viewer_messages.h"
+#include "win8/viewer/metro_viewer_constants.h"
namespace win8 {
@@ -32,11 +33,10 @@ void MetroViewerProcessHost::InternalMessageFilter::OnChannelConnected(
}
MetroViewerProcessHost::MetroViewerProcessHost(
- const std::string& ipc_channel_name,
base::SingleThreadTaskRunner* ipc_task_runner) {
channel_.reset(new IPC::ChannelProxy(
- ipc_channel_name.c_str(),
+ kMetroViewerIPCChannelName,
IPC::Channel::MODE_NAMED_SERVER,
this,
ipc_task_runner));
diff --git a/win8/viewer/metro_viewer_process_host.h b/win8/viewer/metro_viewer_process_host.h
index 288a320..67a6f7c 100644
--- a/win8/viewer/metro_viewer_process_host.h
+++ b/win8/viewer/metro_viewer_process_host.h
@@ -5,8 +5,6 @@
#ifndef WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_
#define WIN8_VIEWER_METRO_VIEWER_PROCESS_HOST_H_
-#include <string>
-
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
@@ -32,13 +30,14 @@ class MetroViewerProcessHost : public IPC::Listener,
public IPC::Sender,
public base::NonThreadSafe {
public:
- // Initializes a viewer process host over |ipc_channel_name|. The given task
- // runner correspond to a thread on which IPC::Channel is created and used
- // (e.g. IO thread). Instantly connects to the viewer process if one is
- // already connected to |ipc_channel_name|; a viewer can otherwise be
- // launched synchronously via LaunchViewerAndWaitForConnection().
- MetroViewerProcessHost(const std::string& ipc_channel_name,
- base::SingleThreadTaskRunner* ipc_task_runner);
+ // Initializes a viewer process host to connect to the Metro viewer process
+ // over IPC. The given task runner correspond to a thread on which
+ // IPC::Channel is created and used (e.g. IO thread). Instantly connects to
+ // the viewer process if one is already connected to |ipc_channel_name|; a
+ // viewer can otherwise be launched synchronously via
+ // LaunchViewerAndWaitForConnection().
+ explicit MetroViewerProcessHost(
+ base::SingleThreadTaskRunner* ipc_task_runner);
virtual ~MetroViewerProcessHost();
// Returns the process id of the viewer process if one is connected to this
diff --git a/win8/win8.gyp b/win8/win8.gyp
index 6e3d5a8..00bfa3b 100644
--- a/win8/win8.gyp
+++ b/win8/win8.gyp
@@ -60,6 +60,8 @@
'../ui/metro_viewer/metro_viewer.gyp:metro_viewer_messages',
],
'sources': [
+ 'viewer/metro_viewer_constants.cc',
+ 'viewer/metro_viewer_constants.h',
'viewer/metro_viewer_process_host.cc',
'viewer/metro_viewer_process_host.h',
],