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

Unified Diff: win8/metro_driver/chrome_app_view_ash.cc

Issue 227573007: Third part of porting Chrome Ash to Windows 7 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lf 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
Index: win8/metro_driver/chrome_app_view_ash.cc
diff --git a/win8/metro_driver/chrome_app_view_ash.cc b/win8/metro_driver/chrome_app_view_ash.cc
index 8e1f0e64d233d152141f2bf87267b7cdfcecf668..6d44a07df1b3d83d6a06cd9195430b28c8563bab 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() {
@@ -1006,22 +1008,24 @@ HRESULT ChromeAppViewAsh::OnActivate(
winapp::Core::ICoreApplicationView*,
winapp::Activation::IActivatedEventArgs* args) {
DVLOG(1) << __FUNCTION__;
- // Note: If doing more work in this function, you migth need to call
- // get_PreviousExecutionState() and skip the work if the result is
- // ApplicationExecutionState_Running and globals.previous_state is too.
- args->get_PreviousExecutionState(&globals.previous_state);
- DVLOG(1) << "Previous Execution State: " << globals.previous_state;
-
- winapp::Activation::ActivationKind activation_kind;
- CheckHR(args->get_Kind(&activation_kind));
- DVLOG(1) << "Activation kind: " << activation_kind;
-
- if (activation_kind == winapp::Activation::ActivationKind_Search)
- HandleSearchRequest(args);
- else if (activation_kind == winapp::Activation::ActivationKind_Protocol)
- HandleProtocolRequest(args);
- else
- LaunchChromeBrowserProcess(NULL, args);
+ if (args) {
+ // Note: If doing more work in this function, you migth need to call
+ // get_PreviousExecutionState() and skip the work if the result is
+ // ApplicationExecutionState_Running and globals.previous_state is too.
+ args->get_PreviousExecutionState(&globals.previous_state);
+ DVLOG(1) << "Previous Execution State: " << globals.previous_state;
+
+ winapp::Activation::ActivationKind activation_kind;
+ CheckHR(args->get_Kind(&activation_kind));
+ DVLOG(1) << "Activation kind: " << activation_kind;
+
+ if (activation_kind == winapp::Activation::ActivationKind_Search)
+ HandleSearchRequest(args);
+ else if (activation_kind == winapp::Activation::ActivationKind_Protocol)
+ HandleProtocolRequest(args);
+ else
+ LaunchChromeBrowserProcess(NULL, args);
+ }
// We call ICoreWindow::Activate after the handling for the search/protocol
// requests because Chrome can be launched to handle a search request which
// in turn launches the chrome browser process in desktop mode via

Powered by Google App Engine
This is Rietveld 408576698