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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 5 years, 6 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
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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 10
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 void HWNDMessageHandler::DispatchKeyEventPostIME(const ui::KeyEvent& key) { 850 void HWNDMessageHandler::DispatchKeyEventPostIME(const ui::KeyEvent& key) {
851 SetMsgHandled(delegate_->HandleKeyEvent(key)); 851 SetMsgHandled(delegate_->HandleKeyEvent(key));
852 } 852 }
853 853
854 //////////////////////////////////////////////////////////////////////////////// 854 ////////////////////////////////////////////////////////////////////////////////
855 // HWNDMessageHandler, gfx::WindowImpl overrides: 855 // HWNDMessageHandler, gfx::WindowImpl overrides:
856 856
857 HICON HWNDMessageHandler::GetDefaultWindowIcon() const { 857 HICON HWNDMessageHandler::GetDefaultWindowIcon() const {
858 if (use_system_default_icon_) 858 if (use_system_default_icon_)
859 return nullptr; 859 return nullptr;
860 return ViewsDelegate::views_delegate 860 return ViewsDelegate::GetInstance()
861 ? ViewsDelegate::views_delegate->GetDefaultWindowIcon() 861 ? ViewsDelegate::GetInstance()->GetDefaultWindowIcon()
862 : nullptr; 862 : nullptr;
863 } 863 }
864 864
865 HICON HWNDMessageHandler::GetSmallWindowIcon() const { 865 HICON HWNDMessageHandler::GetSmallWindowIcon() const {
866 if (use_system_default_icon_) 866 if (use_system_default_icon_)
867 return nullptr; 867 return nullptr;
868 return ViewsDelegate::views_delegate 868 return ViewsDelegate::GetInstance()
869 ? ViewsDelegate::views_delegate->GetSmallWindowIcon() 869 ? ViewsDelegate::GetInstance()->GetSmallWindowIcon()
870 : nullptr; 870 : nullptr;
871 } 871 }
872 872
873 LRESULT HWNDMessageHandler::OnWndProc(UINT message, 873 LRESULT HWNDMessageHandler::OnWndProc(UINT message,
874 WPARAM w_param, 874 WPARAM w_param,
875 LPARAM l_param) { 875 LPARAM l_param) {
876 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. 876 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
877 tracked_objects::ScopedTracker tracking_profile1( 877 tracked_objects::ScopedTracker tracking_profile1(
878 FROM_HERE_WITH_EXPLICIT_FUNCTION( 878 FROM_HERE_WITH_EXPLICIT_FUNCTION(
879 "440919 HWNDMessageHandler::OnWndProc1")); 879 "440919 HWNDMessageHandler::OnWndProc1"));
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 gfx::Point(CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param))); 990 gfx::Point(CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param)));
991 *handled = IsMsgHandled(); 991 *handled = IsMsgHandled();
992 return ret; 992 return ret;
993 } 993 }
994 994
995 //////////////////////////////////////////////////////////////////////////////// 995 ////////////////////////////////////////////////////////////////////////////////
996 // HWNDMessageHandler, private: 996 // HWNDMessageHandler, private:
997 997
998 int HWNDMessageHandler::GetAppbarAutohideEdges(HMONITOR monitor) { 998 int HWNDMessageHandler::GetAppbarAutohideEdges(HMONITOR monitor) {
999 autohide_factory_.InvalidateWeakPtrs(); 999 autohide_factory_.InvalidateWeakPtrs();
1000 return ViewsDelegate::views_delegate ? 1000 return ViewsDelegate::GetInstance()
1001 ViewsDelegate::views_delegate->GetAppbarAutohideEdges( 1001 ? ViewsDelegate::GetInstance()->GetAppbarAutohideEdges(
1002 monitor, 1002 monitor,
1003 base::Bind(&HWNDMessageHandler::OnAppbarAutohideEdgesChanged, 1003 base::Bind(&HWNDMessageHandler::OnAppbarAutohideEdgesChanged,
1004 autohide_factory_.GetWeakPtr())) : 1004 autohide_factory_.GetWeakPtr()))
1005 ViewsDelegate::EDGE_BOTTOM; 1005 : ViewsDelegate::EDGE_BOTTOM;
1006 } 1006 }
1007 1007
1008 void HWNDMessageHandler::OnAppbarAutohideEdgesChanged() { 1008 void HWNDMessageHandler::OnAppbarAutohideEdgesChanged() {
1009 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. 1009 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
1010 tracked_objects::ScopedTracker tracking_profile( 1010 tracked_objects::ScopedTracker tracking_profile(
1011 FROM_HERE_WITH_EXPLICIT_FUNCTION( 1011 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1012 "440919 HWNDMessageHandler::OnAppbarAutohideEdgesChanged")); 1012 "440919 HWNDMessageHandler::OnAppbarAutohideEdgesChanged"));
1013 1013
1014 // This triggers querying WM_NCCALCSIZE again. 1014 // This triggers querying WM_NCCALCSIZE again.
1015 RECT client; 1015 RECT client;
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2736 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2737 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2737 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2738 } 2738 }
2739 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2739 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2740 // to notify our children too, since we can have MDI child windows who need to 2740 // to notify our children too, since we can have MDI child windows who need to
2741 // update their appearance. 2741 // update their appearance.
2742 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2742 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2743 } 2743 }
2744 2744
2745 } // namespace views 2745 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698