Thursday, February 14, 2013

Ensure that themes in desktop chrome AURA on Windows use the opaque browser frame...

Relanding?this?as?the?original?attempt?caused?a?bunch?of?browser?test?and?other?failures?because?of?an?infinite
recursion?crash.?This?occurred?because?the?newly?added?helper?function?chrome::ShouldUseNativeFrame?invoked?the
ShouldUseNativeFrame?function?on?the?native?widget?passed?in?which?as?per?this?change?calls?back?into?the?helper?function
leading?to?an?infinite?recursion?crash.

Fix?is?to?only?invoke?the?helper?if?the?underlying?native?widget?implementation?of?ShouldUseNativeFrame?returns?true.
This?typically?returns?true?if?the?aero?theme?is?to?be?used?on?Windows.

To?achieve?this?we?need?to?mimic?the?implementation?in?BrowserFrameWin::ShouldUseNativeFrame?in?the
DesktopBrowserFrameAura::ShouldUseNativeFrame?override.

The?code?in?BrowserFrameWin::ShouldUseNativeFrame?has?been?moved?to?a?helper?function?ShouldUseNativeFrame
in?the?chrome?namespace?in?the?newly?added?files?browser_frame_common_win.h/.cc.
This?is?invoked?from?BrowserFrameWin?and?from?the?DesktopBrowserFrameAura?overrides.

BUG=175372
R=sky
Review?URL:?https://codereview.chromium.org/12261017

git-svn-id:?svn://svn.chromium.org/chrome/trunk/src@182347?0039d316-1c4b-4281-b951-d872f2087c98

?#include?"chrome/browser/themes/theme_service.h"

?#include?"chrome/browser/themes/theme_service_factory.h"

?#include?"chrome/browser/ui/views/frame/browser_frame.h"

+#include?"chrome/browser/ui/views/frame/browser_frame_common_win.h"

?#include?"chrome/browser/ui/views/frame/browser_view.h"

?#include?"chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h"

?#include?"chrome/browser/ui/views/tabs/tab_strip.h"

???return?!GetWidget()->GetThemeProvider()->ShouldUseNativeFrame();

?}

?

+bool?BrowserDesktopRootWindowHostWin::ShouldUseNativeFrame()?{

+??if?(!views::DesktopRootWindowHostWin::ShouldUseNativeFrame())

+????return?false;

+??return?chrome::ShouldUseNativeFrame(browser_view_,

+??????????????????????????????????????GetWidget()->GetThemeProvider());

+}

+

?////////////////////////////////////////////////////////////////////////////////

?//?BrowserDesktopRootWindowHostWin,?private:

?

??????????????????????????????WPARAM?w_param,

??????????????????????????????LPARAM?l_param)?OVERRIDE;

???virtual?bool?IsUsingCustomFrame()?const?OVERRIDE;

+??virtual?bool?ShouldUseNativeFrame()?OVERRIDE;

?

???void?UpdateDWMFrame();

?

--- /dev/null

+//?Copyright?(c)?2013?The?Chromium?Authors.?All?rights?reserved.

+//?Use?of?this?source?code?is?governed?by?a?BSD-style?license?that?can?be

+//?found?in?the?LICENSE?file.

+

+#include?"chrome/browser/ui/views/frame/browser_frame_common_win.h"

+

+#include?"chrome/browser/ui/views/frame/browser_view.h"

+#include?"ui/base/theme_provider.h"

+

+namespace?chrome?{

+

+bool?ShouldUseNativeFrame(const?BrowserView*?browser_view,

+??????????????????????????const?ui::ThemeProvider*?theme_provider)?{

+??//?App?panel?windows?draw?their?own?frame.

+??if?(browser_view->IsPanel())

+????return?false;

+

+??//?We?don't?theme?popup?or?app?windows,?so?regardless?of?whether?or?not?a

+??//?theme?is?active?for?normal?browser?windows,?we?don't?want?to?use?the?custom

+??//?frame?for?popups/apps.

+??if?(!browser_view->IsBrowserTypeNormal())?{

+????return?true;

+??}

+??//?Otherwise,?we?use?the?native?frame?when?we're?told?we?should?by?the?theme

+??//?provider?(e.g.?no?custom?theme?is?active).

+??return?theme_provider->ShouldUseNativeFrame();

+}

+

+}??//?namespace?browser

+

--- /dev/null

+//?Copyright?(c)?2013?The?Chromium?Authors.?All?rights?reserved.

+//?Use?of?this?source?code?is?governed?by?a?BSD-style?license?that?can?be

+//?found?in?the?LICENSE?file.

+

+#ifndef?CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_COMMON_WIN_H_

+#define?CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_COMMON_WIN_H_

+

+class?BrowserView;

+

+namespace?ui?{

+class?ThemeProvider;

+}

+

+namespace?chrome?{

+//?Returns?true?if?we?should?use?the?native?i.e.?Glass?browser?frame.

+//?for?the?BrowserView?passed?in.

+bool?ShouldUseNativeFrame(const?BrowserView*?browser_view,

+??????????????????????????const?ui::ThemeProvider*?theme_provider);

+}

+

+#endif??//?CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_COMMON_WIN_H_

?#include?"chrome/browser/ui/browser_commands.h"

?#include?"chrome/browser/ui/browser_finder.h"

?#include?"chrome/browser/ui/tabs/tab_strip_model.h"

+#include?"chrome/browser/ui/views/frame/browser_frame_common_win.h"

?#include?"chrome/browser/ui/views/frame/browser_view.h"

?#include?"chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h"

?#include?"chrome/browser/ui/views/tabs/tab_strip.h"

?}

?

?bool?BrowserFrameWin::ShouldUseNativeFrame()?const?{

-??//?App?panel?windows?draw?their?own?frame.

-??if?(browser_view_->IsPanel())

+??if?(!NativeWidgetWin::ShouldUseNativeFrame())

?????return?false;

-

-??//?We?don't?theme?popup?or?app?windows,?so?regardless?of?whether?or?not?a

-??//?theme?is?active?for?normal?browser?windows,?we?don't?want?to?use?the?custom

-??//?frame?for?popups/apps.

-??if?(!browser_view_->IsBrowserTypeNormal()?&&

-??????NativeWidgetWin::ShouldUseNativeFrame())?{

-????return?true;

-??}

-

-??//?Otherwise,?we?use?the?native?frame?when?we're?told?we?should?by?the?theme

-??//?provider?(e.g.?no?custom?theme?is?active).

-??return?GetWidget()->GetThemeProvider()->ShouldUseNativeFrame();

+??return?chrome::ShouldUseNativeFrame(browser_view_,

+??????????????????????????????????????GetWidget()->GetThemeProvider());

?}

?

?void?BrowserFrameWin::Show()?{

?????????'browser/ui/views/frame/browser_frame.h',

?????????'browser/ui/views/frame/browser_frame_aura.cc',

?????????'browser/ui/views/frame/browser_frame_aura.h',

+????????'browser/ui/views/frame/browser_frame_common_win.cc',

+????????'browser/ui/views/frame/browser_frame_common_win.h',

?????????'browser/ui/views/frame/browser_frame_win.cc',

?????????'browser/ui/views/frame/browser_frame_win.h',

?????????'browser/ui/views/frame/browser_non_client_frame_view.cc',

Source: http://git.chromium.org/gitweb/?p=chromium.git;a=commitdiff;h=3d6432295caebe55909b782263b1c137012173ac

ufc 145 jones vs evans marian hossa philip humber red sox white sox chuck colson

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.