diff options
author | zturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-03 23:47:57 +0000 |
---|---|---|
committer | zturner@chromium.org <zturner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-03 23:47:57 +0000 |
commit | 99b1c9b53e29d2362f97b21705e1d1b03c6f425f (patch) | |
tree | 7b0b6f3f1eca5683a1bf23df18a92db1f618dc04 /win8 | |
parent | 2da740849051e0df7e730f95fbcc0a44d3922466 (diff) | |
download | chromium_src-99b1c9b53e29d2362f97b21705e1d1b03c6f425f.zip chromium_src-99b1c9b53e29d2362f97b21705e1d1b03c6f425f.tar.gz chromium_src-99b1c9b53e29d2362f97b21705e1d1b03c6f425f.tar.bz2 |
Make the metro viewer responsible for relaunching browser in desktop mode.
Browsers can force a metro -> desktop transition by calling ShellExecuteEx
with a special argument. However, the process that calls ShellExecute must
itself be a metro process. This change implements that behavior. Without
this change, triggering a relaunch in desktop mode while in ash would
launch chrome in the desktop mode, but it would not automatically transition
from metro to desktop.
cpu@:*metro*
bauerb@:chrome\browser\plugins\*
sky@:ui\aura\*
jschuh@:security review for ipc messages in ui\metro_viewer
BUG=280377
Review URL: https://chromiumcodereview.appspot.com/23592024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8')
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 23 | ||||
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.h | 10 |
2 files changed, 30 insertions, 3 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 8686b53..206ea83 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/files/file_path.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/threading/thread.h" @@ -83,6 +84,8 @@ class ChromeChannelListener : public IPC::Listener { virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) + IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURLOnDesktop, + OnOpenURLOnDesktop) IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen, OnDisplayFileOpenDialog) @@ -102,6 +105,14 @@ class ChromeChannelListener : public IPC::Listener { } private: + void OnOpenURLOnDesktop(const base::FilePath& shortcut, + const string16& url) { + ui_proxy_->PostTask(FROM_HERE, + base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop, + base::Unretained(app_view_), + shortcut, url)); + } + void OnSetCursor(int64 cursor) { ui_proxy_->PostTask(FROM_HERE, base::Bind(&ChromeAppViewAsh::OnSetCursor, @@ -502,6 +513,18 @@ HRESULT ChromeAppViewAsh::Unsnap() { } +void ChromeAppViewAsh::OnOpenURLOnDesktop(const base::FilePath& shortcut, + const string16& url) { + base::FilePath::StringType file = shortcut.value(); + SHELLEXECUTEINFO sei = { sizeof(sei) }; + sei.fMask = SEE_MASK_FLAG_LOG_USAGE; + sei.nShow = SW_SHOWNORMAL; + sei.lpFile = file.c_str(); + sei.lpDirectory = L""; + sei.lpParameters = url.c_str(); + BOOL result = ShellExecuteEx(&sei); +} + void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { ::SetCursor(HCURSOR(cursor)); } diff --git a/win8/metro_driver/chrome_app_view_ash.h b/win8/metro_driver/chrome_app_view_ash.h index 57f20b9..62f0476 100644 --- a/win8/metro_driver/chrome_app_view_ash.h +++ b/win8/metro_driver/chrome_app_view_ash.h @@ -10,16 +10,19 @@ #include <windows.ui.input.h> #include <windows.ui.viewmanagement.h> -#include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/string16.h" #include "ui/base/events/event_constants.h" #include "win8/metro_driver/direct3d_helper.h" +namespace base { +class FilePath; +} + namespace IPC { - class Listener; - class ChannelProxy; +class Listener; +class ChannelProxy; } class OpenFilePickerSession; @@ -46,6 +49,7 @@ class ChromeAppViewAsh // Returns S_OK on success. static HRESULT Unsnap(); + void OnOpenURLOnDesktop(const base::FilePath& shortcut, const string16& url); void OnSetCursor(HCURSOR cursor); void OnDisplayFileOpenDialog(const string16& title, const string16& filter, |