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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 // then we try and exit by sending an Alt+F4 key combination to the core | 918 // then we try and exit by sending an Alt+F4 key combination to the core |
919 // window which ensures that the chrome application tile does not show up in | 919 // window which ensures that the chrome application tile does not show up in |
920 // the running metro apps list on the top left corner. | 920 // the running metro apps list on the top left corner. |
921 void ChromeAppViewAsh::OnMetroExit(MetroTerminateMethod method) { | 921 void ChromeAppViewAsh::OnMetroExit(MetroTerminateMethod method) { |
922 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 922 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
923 HWND core_window = core_window_hwnd(); | 923 HWND core_window = core_window_hwnd(); |
924 if (method == TERMINATE_USING_KEY_SEQUENCE && core_window != NULL && | 924 if (method == TERMINATE_USING_KEY_SEQUENCE && core_window != NULL && |
925 core_window == ::GetForegroundWindow()) { | 925 core_window == ::GetForegroundWindow()) { |
926 DVLOG(1) << "We are in the foreground. Exiting via Alt F4"; | 926 DVLOG(1) << "We are in the foreground. Exiting via Alt F4"; |
927 SendKeySequence(VK_F4, ALT); | 927 SendKeySequence(VK_F4, ALT); |
| 928 if (ui_channel_) |
| 929 ui_channel_->Close(); |
| 930 } else { |
| 931 globals.app_exit->Exit(); |
928 } | 932 } |
| 933 } else { |
| 934 if (ui_channel_) |
| 935 ui_channel_->Close(); |
| 936 |
| 937 globals.app_exit->Exit(); |
929 } | 938 } |
930 if (ui_channel_) | |
931 ui_channel_->Close(); | |
932 | |
933 globals.app_exit->Exit(); | |
934 } | 939 } |
935 | 940 |
936 void ChromeAppViewAsh::OnInputSourceChanged() { | 941 void ChromeAppViewAsh::OnInputSourceChanged() { |
937 if (!input_source_) | 942 if (!input_source_) |
938 return; | 943 return; |
939 | 944 |
940 LANGID langid = 0; | 945 LANGID langid = 0; |
941 bool is_ime = false; | 946 bool is_ime = false; |
942 if (!input_source_->GetActiveSource(&langid, &is_ime)) { | 947 if (!input_source_->GetActiveSource(&langid, &is_ime)) { |
943 LOG(ERROR) << "GetActiveSource failed"; | 948 LOG(ERROR) << "GetActiveSource failed"; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 1355 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
1351 CheckHR(core_app.As(&app_exit)); | 1356 CheckHR(core_app.As(&app_exit)); |
1352 globals.app_exit = app_exit.Detach(); | 1357 globals.app_exit = app_exit.Detach(); |
1353 } | 1358 } |
1354 | 1359 |
1355 IFACEMETHODIMP | 1360 IFACEMETHODIMP |
1356 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1361 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
1357 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1362 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
1358 return (*view) ? S_OK : E_OUTOFMEMORY; | 1363 return (*view) ? S_OK : E_OUTOFMEMORY; |
1359 } | 1364 } |
OLD | NEW |