Re-land:
Re-land:

Make sure custom frame windows paint as active when they're
activated.

Rationale for fix:

The code in NativeWidgetWin::OnNCActivate schedules a paint for the entire
non-client view if the window is visible because its activation state has
changed and it'll doubtless require a repaint.

A subsequent hack introduced by me to recover from the "other windows bleed
through the UI" immediately forces a redraw, before the default WM_NCACTIVATE
handler is called for the window.

It seems that the window's active state is only set by or after the default
WM_NCACTIVATE handler, so this hack redraw causes the window to just repaint
itself as inactive since the state hasn't updated yet (and my earlier
refactorings have made the frame ask Windows if the window is active rather than
relying on custom cached state).

So, to address this I moved the hack redraw from NativeWidgetWin::OnNCActivate
to NativeWidgetWin::OnActivate, after the state and redraws should have
happened. This corrects the issue for me.

Update for re-land: Changed the way the widget determines if it is active. For
some reason this change was triggering test failures because the test for
window status against WS_ACTIVECAPTION used by the internal function
IsWindowActive was failing in the test environment. This code is better replaced
by a test against the Windows GetActiveWindow() function.

http://crbug.com/85791
TEST=see bug
Review URL: http://codereview.chromium.org/7165003

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@89513 0039d316-1c4b-4281-b951-d872f2087c98

axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,nacl-webkit/chrome_deps,junmin-zhu/chromium-rivertrail,nacl-webkit/chrome_deps,Chilledheart/chromium,markYoungH/chromium.src,mogoweb/chromium-crosswalk,nacl-webkit/chrome_deps,fujunwei/chromium-crosswalk,robclark/chromium,ondra-novak/chromium.src,littlstar/chromium.src,anirudhSK/chromium,Fireblend/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,fujunwei/chromium-crosswalk,robclark/chromium,timopulkkinen/BubbleFish,dednal/chromium.src,keishi/chromium,timopulkkinen/BubbleFish,pozdnyakov/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,axinging/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,robclark/chromium,anirudhSK/chromium,dednal/chromium.src,dushu1203/chromium.src,pozdnyakov/chromium-crosswalk,anirudhSK/chromium,keishi/chromium,mohamed--abdel-maksoud/chromium.src,ChromiumWebApps/chromium,Just-D/chromium-1,PeterWangIntel/chromium-crosswalk,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,patrickm/chromium.src,hgl888/chromium-crosswalk,ondra-novak/chromium.src,patrickm/chromium.src,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,littlstar/chromium.src,Chilledheart/chromium,anirudhSK/chromium,bright-sparks/chromium-spacewalk,robclark/chromium,zcbenz/cefode-chromium,ltilve/chromium,nacl-webkit/chrome_deps,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,pozdnyakov/chromium-crosswalk,rogerwang/chromium,junmin-zhu/chromium-rivertrail,keishi/chromium,hgl888/chromium-crosswalk-efl,hujiajie/pa-chromium,littlstar/chromium.src,dednal/chromium.src,rogerwang/chromium,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,M4sse/chromium.src,Chilledheart/chromium,crosswalk-project/chromium-crosswalk-efl,patrickm/chromium.src,jaruba/chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk,mogoweb/chromium-crosswalk,Just-D/chromium-1,timopulkkinen/BubbleFish,Chilledheart/chromium,dednal/chromium.src,axinging/chromium-crosswalk,dednal/chromium.src,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,M4sse/chromium.src,dushu1203/chromium.src,anirudhSK/chromium,M4sse/chromium.src,rogerwang/chromium,M4sse/chromium.src,pozdnyakov/chromium-crosswalk,markYoungH/chromium.src,patrickm/chromium.src,Jonekee/chromium.src,Chilledheart/chromium,hujiajie/pa-chromium,ondra-novak/chromium.src,ondra-novak/chromium.src,zcbenz/cefode-chromium,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,dushu1203/chromium.src,Fireblend/chromium-crosswalk,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk-efl,littlstar/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,zcbenz/cefode-chromium,keishi/chromium,markYoungH/chromium.src,littlstar/chromium.src,jaruba/chromium.src,zcbenz/cefode-chromium,hgl888/chromium-crosswalk-efl,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,keishi/chromium,rogerwang/chromium,nacl-webkit/chrome_deps,pozdnyakov/chromium-crosswalk,krieger-od/nwjs_chromium.src,hujiajie/pa-chromium,fujunwei/chromium-crosswalk,jaruba/chromium.src,robclark/chromium,M4sse/chromium.src,zcbenz/cefode-chromium,rogerwang/chromium,crosswalk-project/chromium-crosswalk-efl,mogoweb/chromium-crosswalk,Jonekee/chromium.src,zcbenz/cefode-chromium,hujiajie/pa-chromium,nacl-webkit/chrome_deps,chuan9/chromium-crosswalk,bright-sparks/chromium-spacewalk,rogerwang/chromium,bright-sparks/chromium-spacewalk,timopulkkinen/BubbleFish,TheTypoMaster/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,hujiajie/pa-chromium,Jonekee/chromium.src,fujunwei/chromium-crosswalk,anirudhSK/chromium,dushu1203/chromium.src,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,nacl-webkit/chrome_deps,M4sse/chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,mogoweb/chromium-crosswalk,littlstar/chromium.src,robclark/chromium,hgl888/chromium-crosswalk-efl,ondra-novak/chromium.src,junmin-zhu/chromium-rivertrail,hgl888/chromium-crosswalk-efl,robclark/chromium,crosswalk-project/chromium-crosswalk-efl,anirudhSK/chromium,dushu1203/chromium.src,hujiajie/pa-chromium,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,bright-sparks/chromium-spacewalk,Just-D/chromium-1,jaruba/chromium.src,markYoungH/chromium.src,chuan9/chromium-crosswalk,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,Just-D/chromium-1,Fireblend/chromium-crosswalk,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk-efl,keishi/chromium,dushu1203/chromium.src,patrickm/chromium.src,Just-D/chromium-1,timopulkkinen/BubbleFish,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,TheTypoMaster/chromium-crosswalk,robclark/chromium,anirudhSK/chromium,keishi/chromium,keishi/chromium,bright-sparks/chromium-spacewalk,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,Chilledheart/chromium,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,markYoungH/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk-efl,ltilve/chromium,patrickm/chromium.src,markYoungH/chromium.src,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,rogerwang/chromium,timopulkkinen/BubbleFish,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,fujunwei/chromium-crosswalk,Chilledheart/chromium,nacl-webkit/chrome_deps,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,nacl-webkit/chrome_deps,ChromiumWebApps/chromium,hujiajie/pa-chromium,dushu1203/chromium.src,patrickm/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk,nacl-webkit/chrome_deps,axinging/chromium-crosswalk,hujiajie/pa-chromium,Jonekee/chromium.src,dushu1203/chromium.src,ltilve/chromium,PeterWangIntel/chromium-crosswalk,mogoweb/chromium-crosswalk,keishi/chromium,mohamed--abdel-maksoud/chromium.src,M4sse/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,timopulkkinen/BubbleFish,ltilve/chromium,krieger-od/nwjs_chromium.src,hujiajie/pa-chromium,zcbenz/cefode-chromium,PeterWangIntel/chromium-crosswalk,Just-D/chromium-1,ondra-novak/chromium.src,jaruba/chromium.src,robclark/chromium,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,dushu1203/chromium.src,anirudhSK/chromium,PeterWangIntel/chromium-crosswalk,krieger-od/nwjs_chromium.src,pozdnyakov/chromium-crosswalk,hgl888/chromium-crosswalk,rogerwang/chromium,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,Just-D/chromium-1,littlstar/chromium.src,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,Jonekee/chromium.src,Fireblend/chromium-crosswalk,anirudhSK/chromium,chuan9/chromium-crosswalk,ltilve/chromium,M4sse/chromium.src,zcbenz/cefode-chromium,Jonekee/chromium.src,chuan9/chromium-crosswalk,ltilve/chromium,Chilledheart/chromium,markYoungH/chromium.src,ltilve/chromium,mogoweb/chromium-crosswalk,markYoungH/chromium.src,keishi/chromium,robclark/chromium,timopulkkinen/BubbleFish,mohamed--abdel-maksoud/chromium.src,krieger-od/nwjs_chromium.src,Pluto-tv/chromium-crosswalk,jaruba/chromium.src,mogoweb/chromium-crosswalk,ltilve/chromium,crosswalk-project/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,Pluto-tv/chromium-crosswalk,dednal/chromium.src,M4sse/chromium.src,anirudhSK/chromium,crosswalk-project/chromium-crosswalk-efl,dednal/chromium.src,timopulkkinen/BubbleFish,chuan9/chromium-crosswalk,M4sse/chromium.src,patrickm/chromium.src,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,hgl888/chromium-crosswalk-efl,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,dednal/chromium.src,jaruba/chromium.src,pozdnyakov/chromium-crosswalk,hujiajie/pa-chromium,keishi/chromium,ChromiumWebApps/chromium,crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,jaruba/chromium.src,ltilve/chromium,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,markYoungH/chromium.src,littlstar/chromium.src,dednal/chromium.src,ChromiumWebApps/chromium,rogerwang/chromium,ChromiumWebApps/chromium,rogerwang/chromium,fujunwei/chromium-crosswalk,timopulkkinen/BubbleFish,Just-D/chromium-1,chuan9/chromium-crosswalk,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,junmin-zhu/chromium-rivertrail,Just-D/chromium-1,junmin-zhu/chromium-rivertrail,junmin-zhu/chromium-rivertrail,Pluto-tv/chromium-crosswalk,ondra-novak/chromium.src,ChromiumWebApps/chromium,zcbenz/cefode-chromium,Fireblend/chromium-crosswalk,zcbenz/cefode-chromium,Jonekee/chromium.src,ondra-novak/chromium.src,timopulkkinen/BubbleFish,junmin-zhu/chromium-rivertrail,PeterWangIntel/chromium-crosswalk,ChromiumWebApps/chromium,markYoungH/chromium.src