Chromium Code Reviews| 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 if (FAILED(hr)) | 870 if (FAILED(hr)) |
| 871 return hr; | 871 return hr; |
| 872 | 872 |
| 873 ui_channel_->Send(new MetroViewerHostMsg_Character(char_code, | 873 ui_channel_->Send(new MetroViewerHostMsg_Character(char_code, |
| 874 status.RepeatCount, | 874 status.RepeatCount, |
| 875 status.ScanCode, | 875 status.ScanCode, |
| 876 GetKeyboardEventFlags())); | 876 GetKeyboardEventFlags())); |
| 877 return S_OK; | 877 return S_OK; |
| 878 } | 878 } |
| 879 | 879 |
| 880 HRESULT ChromeAppViewAsh::OnVisibilityChanged( | 880 HRESULT ChromeAppViewAsh::OnVisibilityChanged( |
|
grt (UTC plus 2)
2013/10/15 17:23:26
is there any reason not to remove this and visibil
gab
2013/10/15 17:53:26
As I mentioned on the first patch set (should I st
grt (UTC plus 2)
2013/10/15 19:13:19
I feel strongly that we should not keep dead code.
gab
2013/10/15 19:18:41
Okay, done.
| |
| 881 winui::Core::ICoreWindow* sender, | 881 winui::Core::ICoreWindow* sender, |
| 882 winui::Core::IVisibilityChangedEventArgs* args) { | 882 winui::Core::IVisibilityChangedEventArgs* args) { |
| 883 boolean visible = false; | 883 boolean visible = false; |
| 884 HRESULT hr = args->get_Visible(&visible); | 884 HRESULT hr = args->get_Visible(&visible); |
| 885 if (FAILED(hr)) | 885 if (FAILED(hr)) |
| 886 return hr; | 886 return hr; |
| 887 | 887 // We used to send MetroViewerHostMsg_VisibilityChanged to the browser process |
| 888 ui_channel_->Send(new MetroViewerHostMsg_VisibilityChanged(!!visible)); | 888 // upon receiving this message to catch when Ash gets activated, but it turned |
| 889 // out that this wasn't sufficient as Ash can be visible yet a Chrome | |
| 890 // desktop window can be active in a multiple monitor scenario, resulting in | |
| 891 // Ash not being considered as reactivated when refocused (since this message | |
| 892 // was never received as the visibility didn't change). We switched to using | |
| 893 // OnWindowActivated() below to solve this problem. | |
| 889 return S_OK; | 894 return S_OK; |
| 890 } | 895 } |
| 891 | 896 |
| 892 HRESULT ChromeAppViewAsh::OnWindowActivated( | 897 HRESULT ChromeAppViewAsh::OnWindowActivated( |
| 893 winui::Core::ICoreWindow* sender, | 898 winui::Core::ICoreWindow* sender, |
| 894 winui::Core::IWindowActivatedEventArgs* args) { | 899 winui::Core::IWindowActivatedEventArgs* args) { |
| 895 winui::Core::CoreWindowActivationState state; | 900 winui::Core::CoreWindowActivationState state; |
| 896 HRESULT hr = args->get_WindowActivationState(&state); | 901 HRESULT hr = args->get_WindowActivationState(&state); |
| 897 if (FAILED(hr)) | 902 if (FAILED(hr)) |
| 898 return hr; | 903 return hr; |
| 904 | |
| 905 // Treat both full activation (Ash was reopened from the Start Screen or from | |
| 906 // any other Metro entry point in Windows) and pointer activation (user | |
| 907 // clicked back in Ash after using another app on another monitor) the same. | |
| 908 if (state == winui::Core::CoreWindowActivationState_CodeActivated || | |
| 909 state == winui::Core::CoreWindowActivationState_PointerActivated) { | |
| 910 ui_channel_->Send(new MetroViewerHostMsg_WindowActivated()); | |
| 911 } | |
| 899 return S_OK; | 912 return S_OK; |
| 900 } | 913 } |
| 901 | 914 |
| 902 HRESULT ChromeAppViewAsh::HandleSearchRequest( | 915 HRESULT ChromeAppViewAsh::HandleSearchRequest( |
| 903 winapp::Activation::IActivatedEventArgs* args) { | 916 winapp::Activation::IActivatedEventArgs* args) { |
| 904 mswr::ComPtr<winapp::Activation::ISearchActivatedEventArgs> search_args; | 917 mswr::ComPtr<winapp::Activation::ISearchActivatedEventArgs> search_args; |
| 905 CheckHR(args->QueryInterface( | 918 CheckHR(args->QueryInterface( |
| 906 winapp::Activation::IID_ISearchActivatedEventArgs, &search_args)); | 919 winapp::Activation::IID_ISearchActivatedEventArgs, &search_args)); |
| 907 | 920 |
| 908 if (!ui_channel_) { | 921 if (!ui_channel_) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 986 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; | 999 mswr::ComPtr<winapp::Core::ICoreApplicationExit> app_exit; |
| 987 CheckHR(core_app.As(&app_exit)); | 1000 CheckHR(core_app.As(&app_exit)); |
| 988 globals.app_exit = app_exit.Detach(); | 1001 globals.app_exit = app_exit.Detach(); |
| 989 } | 1002 } |
| 990 | 1003 |
| 991 IFACEMETHODIMP | 1004 IFACEMETHODIMP |
| 992 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { | 1005 ChromeAppViewFactory::CreateView(winapp::Core::IFrameworkView** view) { |
| 993 *view = mswr::Make<ChromeAppViewAsh>().Detach(); | 1006 *view = mswr::Make<ChromeAppViewAsh>().Detach(); |
| 994 return (*view) ? S_OK : E_OUTOFMEMORY; | 1007 return (*view) ? S_OK : E_OUTOFMEMORY; |
| 995 } | 1008 } |
| OLD | NEW |