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

Unified Diff: win8/metro_driver/metro_driver_win7.cc

Issue 235933004: 3rd part of porting Chrome Ash to Windows 7 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ash_unittests fixes Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.cc ('k') | win8/viewer/metro_viewer_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win8/metro_driver/metro_driver_win7.cc
diff --git a/win8/metro_driver/metro_driver_win7.cc b/win8/metro_driver/metro_driver_win7.cc
index 2e5aba73fc4d6b2f9a065af77522ca5cce87dacb..fedba658ac3afb6a19b6dde0ee3baa009d5b25fa 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(
« no previous file with comments | « win8/metro_driver/chrome_app_view_ash.cc ('k') | win8/viewer/metro_viewer_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698