summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/host/ash_window_tree_host_win.cc2
-rw-r--r--ash/test/ash_test_helper.cc4
-rw-r--r--ash/wm/workspace/workspace_event_handler_unittest.cc2
-rw-r--r--chrome/browser/browser_process_platform_part_aurawin.cc28
-rw-r--r--chrome/browser/metro_utils/metro_chrome_win.cc5
-rw-r--r--ui/gfx/win/dpi.cc4
-rw-r--r--win8/metro_driver/chrome_app_view_ash.cc20
-rw-r--r--win8/metro_driver/metro_driver_win7.cc30
-rw-r--r--win8/viewer/metro_viewer_process_host.cc32
9 files changed, 83 insertions, 44 deletions
diff --git a/ash/host/ash_window_tree_host_win.cc b/ash/host/ash_window_tree_host_win.cc
index 5ea0f4a..27fd5a4 100644
--- a/ash/host/ash_window_tree_host_win.cc
+++ b/ash/host/ash_window_tree_host_win.cc
@@ -108,7 +108,7 @@ class ASH_EXPORT AshWindowTreeHostWin : public AshWindowTreeHost,
} // namespace
AshWindowTreeHost* AshWindowTreeHost::Create(const gfx::Rect& initial_bounds) {
- if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ if (base::win::GetVersion() >= base::win::VERSION_WIN7 &&
!CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kForceAshToDesktop))
return AshRemoteWindowTreeHostWin::GetInstance();
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc
index 75034c5..f9e812c 100644
--- a/ash/test/ash_test_helper.cc
+++ b/ash/test/ash_test_helper.cc
@@ -154,7 +154,7 @@ aura::Window* AshTestHelper::CurrentContext() {
// static
bool AshTestHelper::SupportsMultipleDisplays() {
#if defined(OS_WIN)
- return base::win::GetVersion() < base::win::VERSION_WIN8;
+ return false;
#else
return true;
#endif
@@ -163,7 +163,7 @@ bool AshTestHelper::SupportsMultipleDisplays() {
// static
bool AshTestHelper::SupportsHostWindowResize() {
#if defined(OS_WIN)
- return base::win::GetVersion() < base::win::VERSION_WIN8;
+ return false;
#else
return true;
#endif
diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc
index ce69947..f9a1e1a3 100644
--- a/ash/wm/workspace/workspace_event_handler_unittest.cc
+++ b/ash/wm/workspace/workspace_event_handler_unittest.cc
@@ -142,7 +142,7 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisResizeEdge) {
#if defined(OS_WIN)
// Multi display test does not run on Win8 bot. crbug.com/247427.
- if (base::win::GetVersion() >= base::win::VERSION_WIN8)
+ if (!SupportsMultipleDisplays())
return;
#endif
diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc
index f145439..65a08d9 100644
--- a/chrome/browser/browser_process_platform_part_aurawin.cc
+++ b/chrome/browser/browser_process_platform_part_aurawin.cc
@@ -41,21 +41,21 @@ void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing(
// Check for Windows 8 specific commandlines requesting that this process
// either connect to an existing viewer or launch a new viewer and
// synchronously wait for it to connect.
- if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
- bool launch = command_line.HasSwitch(switches::kViewerLaunchViaAppId);
- bool connect = (launch ||
- (command_line.HasSwitch(switches::kViewerConnect) &&
- !metro_viewer_process_host_.get()));
- if (connect) {
- // Create a host to connect to the Metro viewer process over IPC.
- metro_viewer_process_host_.reset(new ChromeMetroViewerProcessHost());
- if (launch) {
- CHECK(metro_viewer_process_host_->LaunchViewerAndWaitForConnection(
- command_line.GetSwitchValueNative(
- switches::kViewerLaunchViaAppId)));
- }
- }
+
+ bool launch = command_line.HasSwitch(switches::kViewerLaunchViaAppId);
+ bool connect = (launch ||
+ (command_line.HasSwitch(switches::kViewerConnect) &&
+ !metro_viewer_process_host_.get()));
+ if (!connect)
+ return;
+ // Create a host to connect to the Metro viewer process over IPC.
+ metro_viewer_process_host_.reset(new ChromeMetroViewerProcessHost());
+ if (launch) {
+ CHECK(metro_viewer_process_host_->LaunchViewerAndWaitForConnection(
+ command_line.GetSwitchValueNative(
+ switches::kViewerLaunchViaAppId)));
}
+
}
void BrowserProcessPlatformPart::Observe(
diff --git a/chrome/browser/metro_utils/metro_chrome_win.cc b/chrome/browser/metro_utils/metro_chrome_win.cc
index 30aeca5..d4985a6 100644
--- a/chrome/browser/metro_utils/metro_chrome_win.cc
+++ b/chrome/browser/metro_utils/metro_chrome_win.cc
@@ -12,6 +12,7 @@
#include "base/win/metro.h"
#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
+#include "base/win/windows_version.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/shell_util.h"
@@ -19,6 +20,10 @@
namespace chrome {
bool ActivateMetroChrome() {
+ // TODO(cpu): For Win7 we need to activate differently.
+ if (base::win::GetVersion() < base::win::VERSION_WIN8)
+ return true;
+
base::FilePath chrome_exe;
if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
NOTREACHED() << "Failed to get chrome exe path";
diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc
index fbcbb77..30c90b8 100644
--- a/ui/gfx/win/dpi.cc
+++ b/ui/gfx/win/dpi.cc
@@ -44,6 +44,10 @@ float GetUnforcedDeviceScaleFactor() {
float GetModernUIScaleWrapper() {
float result = 1.0f;
+ // TODO(cpu) : Fix scale for Win7.
+ if (base::win::GetVersion() < base::win::VERSION_WIN8)
+ return result;
+
typedef float(WINAPI *GetModernUIScalePtr)(VOID);
HMODULE lib = LoadLibraryA("metro_driver.dll");
if (lib) {
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(
diff --git a/win8/viewer/metro_viewer_process_host.cc b/win8/viewer/metro_viewer_process_host.cc
index a44ea3c..cb6a202 100644
--- a/win8/viewer/metro_viewer_process_host.cc
+++ b/win8/viewer/metro_viewer_process_host.cc
@@ -10,12 +10,14 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
+#include "base/path_service.h"
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/strings/string16.h"
#include "base/synchronization/waitable_event.h"
#include "base/time/time.h"
#include "base/win/scoped_comptr.h"
+#include "base/win/windows_version.h"
#include "ipc/ipc_message.h"
#include "ipc/ipc_message_macros.h"
#include "ui/aura/remote_window_tree_host_win.h"
@@ -87,17 +89,27 @@ bool MetroViewerProcessHost::LaunchViewerAndWaitForConnection(
message_filter_ = new InternalMessageFilter(this);
channel_->AddFilter(message_filter_);
- base::win::ScopedComPtr<IApplicationActivationManager> activator;
- HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager);
- if (SUCCEEDED(hr)) {
- DWORD pid = 0;
- // Use the "connect" verb to
- hr = activator->ActivateApplication(
- app_user_model_id.c_str(), kMetroViewerConnectVerb, AO_NONE, &pid);
- }
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
+ base::win::ScopedComPtr<IApplicationActivationManager> activator;
+ HRESULT hr = activator.CreateInstance(CLSID_ApplicationActivationManager);
+ if (SUCCEEDED(hr)) {
+ DWORD pid = 0;
+ // Use the "connect" verb to
+ hr = activator->ActivateApplication(
+ app_user_model_id.c_str(), kMetroViewerConnectVerb, AO_NONE, &pid);
+ }
- LOG_IF(ERROR, FAILED(hr)) << "Tried and failed to launch Metro Chrome. "
- << "hr=" << std::hex << hr;
+ LOG_IF(ERROR, FAILED(hr)) << "Tried and failed to launch Metro Chrome. "
+ << "hr=" << std::hex << hr;
+ } else {
+ // For Windows 7 we need to launch the viewer ourselves.
+ base::FilePath chrome_path;
+ if (!PathService::Get(base::DIR_EXE, &chrome_path))
+ return false;
+ // TODO(cpu): launch with "-ServerName:DefaultBrowserServer"
+ // note that the viewer might try to launch chrome again.
+ CHECK(false);
+ }
// Having launched the viewer process, now we wait for it to connect.
bool success =