diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-18 00:04:59 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-18 00:04:59 +0000 |
commit | 45214559b6f71458336f00f850e02e43d3cd8415 (patch) | |
tree | 599c94853f179cbf614c043ae61ce6139005f483 /win8/metro_driver | |
parent | b1e93abe8fe317771862c42652312bf36ac4b11a (diff) | |
download | chromium_src-45214559b6f71458336f00f850e02e43d3cd8415.zip chromium_src-45214559b6f71458336f00f850e02e43d3cd8415.tar.gz chromium_src-45214559b6f71458336f00f850e02e43d3cd8415.tar.bz2 |
3rd part of porting Chrome Ash to Windows 7
This is the Chrome side that
1- removes windows 8 specific checks
2- disconnects the fake window_tree_host_win
3- connects the remote_window_tree_host_win
With this change you can now see the ash desktop but not interact with
it since input events have not been enabled.
Here is the second part
https://codereview.chromium.org/211863003/
First part with rationale:
https://codereview.chromium.org/199843004/
Note: this is a redo & rebase of
https://codereview.chromium.org/227573007/
BUG=356475
TEST=none
patch from issue 235683005
BUG=
Review URL: https://codereview.chromium.org/235933004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'win8/metro_driver')
-rw-r--r-- | win8/metro_driver/chrome_app_view_ash.cc | 20 | ||||
-rw-r--r-- | win8/metro_driver/metro_driver_win7.cc | 30 |
2 files changed, 34 insertions, 16 deletions
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc index 8e1f0e6..69c4555 100644 --- a/win8/metro_driver/chrome_app_view_ash.cc +++ b/win8/metro_driver/chrome_app_view_ash.cc @@ -919,16 +919,18 @@ void ChromeAppViewAsh::OnImePopupChanged(ImePopupObserver::EventType event) { // window which ensures that the chrome application tile does not show up in // the running metro apps list on the top left corner. void ChromeAppViewAsh::OnMetroExit(MetroTerminateMethod method) { - HWND core_window = core_window_hwnd(); - if (method == TERMINATE_USING_KEY_SEQUENCE && core_window != NULL && - core_window == ::GetForegroundWindow()) { - DVLOG(1) << "We are in the foreground. Exiting via Alt F4"; - SendKeySequence(VK_F4, ALT); - if (ui_channel_) - ui_channel_->Close(); - } else { - globals.app_exit->Exit(); + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { + HWND core_window = core_window_hwnd(); + if (method == TERMINATE_USING_KEY_SEQUENCE && core_window != NULL && + core_window == ::GetForegroundWindow()) { + DVLOG(1) << "We are in the foreground. Exiting via Alt F4"; + SendKeySequence(VK_F4, ALT); + } } + if (ui_channel_) + ui_channel_->Close(); + + globals.app_exit->Exit(); } void ChromeAppViewAsh::OnInputSourceChanged() { diff --git a/win8/metro_driver/metro_driver_win7.cc b/win8/metro_driver/metro_driver_win7.cc index 2e5aba7..fedba65 100644 --- a/win8/metro_driver/metro_driver_win7.cc +++ b/win8/metro_driver/metro_driver_win7.cc @@ -8,22 +8,31 @@ #include "base/logging.h" EXTERN_C IMAGE_DOS_HEADER __ImageBase; +int g_window_count = 0; LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { PAINTSTRUCT ps; HDC hdc; switch (message) { + case WM_CREATE: + ++g_window_count; + break; case WM_PAINT: hdc = ::BeginPaint(hwnd, &ps); - EndPaint(hwnd, &ps); + ::EndPaint(hwnd, &ps); break; case WM_LBUTTONUP: // TODO(cpu): Remove this test code. ::InvalidateRect(hwnd, NULL, TRUE); break; + case WM_CLOSE: + ::DestroyWindow(hwnd); + break; case WM_DESTROY: - PostQuitMessage(0); + --g_window_count; + if (!g_window_count) + ::PostQuitMessage(0); break; default: return ::DefWindowProc(hwnd, message, wparam, lparam); @@ -51,7 +60,7 @@ HWND CreateMetroTopLevelWindow() { MAKEINTATOM(::RegisterClassExW(&wcex)), L"metro_win7", WS_POPUP | WS_VISIBLE, - 0, 0, 1024, 1024, + 0, 0, 1600, 900, NULL, NULL, hInst, NULL); return hwnd; } @@ -146,7 +155,7 @@ class CoreDispacherEmulation : return E_FAIL; MSG msg = {0}; - while(::GetMessage(&msg, NULL, 0, 0) != 0) { + while((::GetMessage(&msg, NULL, 0, 0) != 0) && g_window_count > 0) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } @@ -194,7 +203,8 @@ class CoreWindowEmulation } ~CoreWindowEmulation() { - ::DestroyWindow(core_hwnd_); + if (core_hwnd_) + ::DestroyWindow(core_hwnd_); } // ICoreWindow implementation: @@ -269,6 +279,8 @@ class CoreWindowEmulation } virtual HRESULT STDMETHODCALLTYPE Close(void) { + ::PostMessage(core_hwnd_, WM_CLOSE, 0, 0); + core_hwnd_ = NULL; return S_OK; } @@ -550,6 +562,10 @@ class CoreApplicationViewEmulation } } + HRESULT Close() { + return core_window_->Close(); + } + // ICoreApplicationView implementation: virtual HRESULT STDMETHODCALLTYPE get_CoreWindow( winui::Core::ICoreWindow** value) { @@ -585,7 +601,7 @@ class CoreApplicationViewEmulation } private: - mswr::ComPtr<winui::Core::ICoreWindow> core_window_; + mswr::ComPtr<CoreWindowEmulation> core_window_; mswr::ComPtr<ActivatedHandler> activated_handler_; }; @@ -665,7 +681,7 @@ class CoreApplicationWin7Emulation // ICoreApplicationExit implementation: virtual HRESULT STDMETHODCALLTYPE Exit(void) { - return S_OK; + return view_emulation_->Close(); } virtual HRESULT STDMETHODCALLTYPE add_Exiting( |