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

Side by Side Diff: chrome/browser/ui/views/app_list/app_list_controller_win.cc

Issue 12326154: [win] Clicking on the taskbar icon should hide the launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Works, and neater to boot Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 if (!current_view_) 692 if (!current_view_)
693 return; 693 return;
694 694
695 // First get the taskbar and jump lists windows (the jump list is the 695 // First get the taskbar and jump lists windows (the jump list is the
696 // context menu which the taskbar uses). 696 // context menu which the taskbar uses).
697 HWND jump_list_hwnd = FindWindow(L"DV2ControlHost", NULL); 697 HWND jump_list_hwnd = FindWindow(L"DV2ControlHost", NULL);
698 HWND taskbar_hwnd = FindWindow(kTrayClassName, NULL); 698 HWND taskbar_hwnd = FindWindow(kTrayClassName, NULL);
699 699
700 HWND app_list_hwnd = GetAppListHWND(); 700 HWND app_list_hwnd = GetAppListHWND();
701 701
702 // Get the focused window, and check if it is one of these windows. Keep 702 // Get the focused window. According to MSDN this will be NULL in some cases,
703 // checking it's parent until either we find one of these windows, or there 703 // "such as when a window is losing activation". In these cases we do not hide
704 // is no parent left. 704 // the launcher. In other cases, we will keep the launcher open if:
705 // - a jump list window has focus, or
706 // - the right mouse button is down and the taskbar has focus, or
707 // - the launcher has regained focus.
708 // This is enough to allow the launcher to be pinned via the right click menu.
705 HWND focused_hwnd = GetForegroundWindow(); 709 HWND focused_hwnd = GetForegroundWindow();
710 if (!focused_hwnd)
711 return;
712
706 while (focused_hwnd) { 713 while (focused_hwnd) {
707 if (focused_hwnd == jump_list_hwnd || 714 if (focused_hwnd == jump_list_hwnd ||
708 focused_hwnd == taskbar_hwnd ||
709 focused_hwnd == app_list_hwnd) { 715 focused_hwnd == app_list_hwnd) {
710 return; 716 return;
711 } 717 }
718 if (focused_hwnd == taskbar_hwnd) {
719 int right_button =
720 GetSystemMetrics(SM_SWAPBUTTON) ? VK_LBUTTON : VK_RBUTTON;
721 bool right_button_down = GetAsyncKeyState(right_button) < 0;
722 if (right_button_down)
723 return;
724
725 break;
726 }
712 focused_hwnd = GetParent(focused_hwnd); 727 focused_hwnd = GetParent(focused_hwnd);
713 } 728 }
714 729
715 // If we get here, the focused window is not the taskbar, it's context menu, 730 // If we get here, the focused window is not the taskbar, it's context menu,
716 // or the app list, so close the app list. 731 // or the app list, so close the app list.
717 DismissAppList(); 732 DismissAppList();
718 } 733 }
719 734
720 HWND AppListController::GetAppListHWND() const { 735 HWND AppListController::GetAppListHWND() const {
721 #if defined(USE_AURA) 736 #if defined(USE_AURA)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 839
825 } // namespace 840 } // namespace
826 841
827 namespace chrome { 842 namespace chrome {
828 843
829 AppListService* GetAppListServiceWin() { 844 AppListService* GetAppListServiceWin() {
830 return AppListController::GetInstance(); 845 return AppListController::GetInstance();
831 } 846 }
832 847
833 } // namespace chrome 848 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698