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

Side by Side Diff: win8/metro_driver/chrome_app_view_ash.cc

Issue 23592024: Make the metro viewer responsible for relaunching browser in desktop mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "win8/metro_driver/stdafx.h" 5 #include "win8/metro_driver/stdafx.h"
6 #include "win8/metro_driver/chrome_app_view_ash.h" 6 #include "win8/metro_driver/chrome_app_view_ash.h"
7 7
8 #include <corewindow.h> 8 #include <corewindow.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <windows.foundation.h> 10 #include <windows.foundation.h>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 globals.app_exit->Exit(); 76 globals.app_exit->Exit();
77 } 77 }
78 78
79 class ChromeChannelListener : public IPC::Listener { 79 class ChromeChannelListener : public IPC::Listener {
80 public: 80 public:
81 ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view) 81 ChromeChannelListener(base::MessageLoop* ui_loop, ChromeAppViewAsh* app_view)
82 : ui_proxy_(ui_loop->message_loop_proxy()), app_view_(app_view) {} 82 : ui_proxy_(ui_loop->message_loop_proxy()), app_view_(app_view) {}
83 83
84 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { 84 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
85 IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message) 85 IPC_BEGIN_MESSAGE_MAP(ChromeChannelListener, message)
86 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_OpenURLOnDesktop,
87 OnOpenURLOnDesktop)
86 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor) 88 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursor, OnSetCursor)
87 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen, 89 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileOpen,
88 OnDisplayFileOpenDialog) 90 OnDisplayFileOpenDialog)
89 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs, 91 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplayFileSaveAs,
90 OnDisplayFileSaveAsDialog) 92 OnDisplayFileSaveAsDialog)
91 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder, 93 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_DisplaySelectFolder,
92 OnDisplayFolderPicker) 94 OnDisplayFolderPicker)
93 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos) 95 IPC_MESSAGE_HANDLER(MetroViewerHostMsg_SetCursorPos, OnSetCursorPos)
94 IPC_MESSAGE_UNHANDLED(__debugbreak()) 96 IPC_MESSAGE_UNHANDLED(__debugbreak())
95 IPC_END_MESSAGE_MAP() 97 IPC_END_MESSAGE_MAP()
96 return true; 98 return true;
97 } 99 }
98 100
99 virtual void OnChannelError() OVERRIDE { 101 virtual void OnChannelError() OVERRIDE {
100 DVLOG(1) << "Channel error"; 102 DVLOG(1) << "Channel error";
101 MetroExit(); 103 MetroExit();
102 } 104 }
103 105
104 private: 106 private:
107 void OnOpenURLOnDesktop(const string16& shortcut, const string16& url) {
108 ui_proxy_->PostTask(FROM_HERE,
109 base::Bind(&ChromeAppViewAsh::OnOpenURLOnDesktop,
110 base::Unretained(app_view_),
111 shortcut, url));
112 }
113
105 void OnSetCursor(int64 cursor) { 114 void OnSetCursor(int64 cursor) {
106 ui_proxy_->PostTask(FROM_HERE, 115 ui_proxy_->PostTask(FROM_HERE,
107 base::Bind(&ChromeAppViewAsh::OnSetCursor, 116 base::Bind(&ChromeAppViewAsh::OnSetCursor,
108 base::Unretained(app_view_), 117 base::Unretained(app_view_),
109 reinterpret_cast<HCURSOR>(cursor))); 118 reinterpret_cast<HCURSOR>(cursor)));
110 } 119 }
111 120
112 void OnDisplayFileOpenDialog(const string16& title, 121 void OnDisplayFileOpenDialog(const string16& title,
113 const string16& filter, 122 const string16& filter,
114 const base::FilePath& default_path, 123 const base::FilePath& default_path,
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (FAILED(hr) || !success) { 504 if (FAILED(hr) || !success) {
496 LOG(ERROR) << "Failed to unsnap. Error 0x" << hr; 505 LOG(ERROR) << "Failed to unsnap. Error 0x" << hr;
497 if (SUCCEEDED(hr)) 506 if (SUCCEEDED(hr))
498 hr = E_UNEXPECTED; 507 hr = E_UNEXPECTED;
499 } 508 }
500 } 509 }
501 return hr; 510 return hr;
502 } 511 }
503 512
504 513
514 void ChromeAppViewAsh::OnOpenURLOnDesktop(const string16& shortcut,
515 const string16& url) {
516 SHELLEXECUTEINFO sei = { sizeof(sei) };
517 sei.fMask = SEE_MASK_FLAG_LOG_USAGE;
518 sei.nShow = SW_SHOWNORMAL;
519 sei.lpFile = shortcut.c_str();
520 sei.lpDirectory = L"";
521 sei.lpParameters = url.c_str();
522 BOOL result = ShellExecuteEx(&sei);
523 }
524
505 void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) { 525 void ChromeAppViewAsh::OnSetCursor(HCURSOR cursor) {
506 ::SetCursor(HCURSOR(cursor)); 526 ::SetCursor(HCURSOR(cursor));
507 } 527 }
508 528
509 void ChromeAppViewAsh::OnDisplayFileOpenDialog( 529 void ChromeAppViewAsh::OnDisplayFileOpenDialog(
510 const string16& title, 530 const string16& title,
511 const string16& filter, 531 const string16& filter,
512 const base::FilePath& default_path, 532 const base::FilePath& default_path,
513 bool allow_multiple_files) { 533 bool allow_multiple_files) {
514 DVLOG(1) << __FUNCTION__; 534 DVLOG(1) << __FUNCTION__;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; 973 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit;
954 CheckHR(core_app.As(&app_exit)); 974 CheckHR(core_app.As(&app_exit));
955 globals.app_exit = app_exit.Detach(); 975 globals.app_exit = app_exit.Detach();
956 } 976 }
957 977
958 IFACEMETHODIMP 978 IFACEMETHODIMP
959 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { 979 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) {
960 *view = mswr::Make<ChromeAppViewAsh>().Detach(); 980 *view = mswr::Make<ChromeAppViewAsh>().Detach();
961 return (*view) ? S_OK : E_OUTOFMEMORY; 981 return (*view) ? S_OK : E_OUTOFMEMORY;
962 } 982 }
OLDNEW
« ui/aura/remote_root_window_host_win.cc ('K') | « win8/metro_driver/chrome_app_view_ash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698