OLD | NEW |
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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 ui_channel_->Send(new MetroViewerHostMsg_Character(char_code, | 1273 ui_channel_->Send(new MetroViewerHostMsg_Character(char_code, |
1274 status.RepeatCount, | 1274 status.RepeatCount, |
1275 status.ScanCode, | 1275 status.ScanCode, |
1276 GetKeyboardEventFlags())); | 1276 GetKeyboardEventFlags())); |
1277 return S_OK; | 1277 return S_OK; |
1278 } | 1278 } |
1279 | 1279 |
1280 HRESULT ChromeAppViewAsh::OnWindowActivated( | 1280 HRESULT ChromeAppViewAsh::OnWindowActivated( |
1281 winui::Core::ICoreWindow* sender, | 1281 winui::Core::ICoreWindow* sender, |
1282 winui::Core::IWindowActivatedEventArgs* args) { | 1282 winui::Core::IWindowActivatedEventArgs* args) { |
1283 winui::Core::CoreWindowActivationState state; | 1283 if (args) { |
1284 HRESULT hr = args->get_WindowActivationState(&state); | 1284 winui::Core::CoreWindowActivationState state; |
1285 if (FAILED(hr)) | 1285 HRESULT hr = args->get_WindowActivationState(&state); |
1286 return hr; | 1286 if (FAILED(hr)) |
| 1287 return hr; |
1287 | 1288 |
1288 // Treat both full activation (Ash was reopened from the Start Screen or from | 1289 // Treat both full activation (Ash was reopened from the Start Screen or |
1289 // any other Metro entry point in Windows) and pointer activation (user | 1290 // from any other Metro entry point in Windows) and pointer activation |
1290 // clicked back in Ash after using another app on another monitor) the same. | 1291 // (user clicked back in Ash after using another app on another monitor) |
1291 if (state == winui::Core::CoreWindowActivationState_CodeActivated || | 1292 // the same. |
1292 state == winui::Core::CoreWindowActivationState_PointerActivated) { | 1293 if (state == winui::Core::CoreWindowActivationState_CodeActivated || |
1293 if (text_service_) | 1294 state == winui::Core::CoreWindowActivationState_PointerActivated) { |
1294 text_service_->OnWindowActivated(); | 1295 if (text_service_) |
1295 ui_channel_->Send(new MetroViewerHostMsg_WindowActivated()); | 1296 text_service_->OnWindowActivated(); |
| 1297 ui_channel_->Send(new MetroViewerHostMsg_WindowActivated(false)); |
| 1298 } |
| 1299 } else { |
| 1300 // On Windows 7, we force a repaint when the window is activated. |
| 1301 ui_channel_->Send(new MetroViewerHostMsg_WindowActivated(true)); |
1296 } | 1302 } |
1297 return S_OK; | 1303 return S_OK; |
1298 } | 1304 } |
1299 | 1305 |
1300 HRESULT ChromeAppViewAsh::HandleSearchRequest( | 1306 HRESULT ChromeAppViewAsh::HandleSearchRequest( |
1301 winapp::Activation::IActivatedEventArgs* args) { | 1307 winapp::Activation::IActivatedEventArgs* args) { |
1302 mswr::ComPtr<winapp::Activation::ISearchActivatedEventArgs> search_args; | 1308 mswr::ComPtr<winapp::Activation::ISearchActivatedEventArgs> search_args; |
1303 CheckHR(args->QueryInterface( | 1309 CheckHR(args->QueryInterface( |
1304 winapp::Activation::IID_ISearchActivatedEventArgs, &search_args)); | 1310 winapp::Activation::IID_ISearchActivatedEventArgs, &search_args)); |
1305 | 1311 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1396 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1391 CheckHR(core_app.As(&app_exit)); | 1397 CheckHR(core_app.As(&app_exit)); |
1392 globals.app_exit = app_exit.Detach(); | 1398 globals.app_exit = app_exit.Detach(); |
1393 } | 1399 } |
1394 | 1400 |
1395 IFACEMETHODIMP | 1401 IFACEMETHODIMP |
1396 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1402 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1397 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1403 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1398 return (*view) ? S_OK : E_OUTOFMEMORY; | 1404 return (*view) ? S_OK : E_OUTOFMEMORY; |
1399 } | 1405 } |
OLD | NEW |