Commit 79e80bf4 authored by mgiuca@chromium.org's avatar mgiuca@chromium.org

OpaqueBrowserFrameViewPlatformSpecific::Create no longer returns NULL.

This avoids duplicating the default logic for all of its methods.
Previously, every time a method was called, we had to test for NULL and
assume the default value for that method (even though the default method
implementation already exists; it was never used). Now the caller
assumes platform_observer_ is non-NULL (via a DCHECK) and it is the base
class's responsibility to provide default methods.

Review URL: https://codereview.chromium.org/124893002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243819 0039d316-1c4b-4281-b951-d872f2087c98
parent ac15d83c
......@@ -428,10 +428,8 @@ void OpaqueBrowserFrameView::Observe(
bool OpaqueBrowserFrameView::ShouldShowWindowIcon() const {
views::WidgetDelegate* delegate = frame()->widget_delegate();
// ShouldShowTitleBar defaults to true.
if (platform_observer_ && !platform_observer_->ShouldShowTitleBar())
return false;
return delegate && delegate->ShouldShowWindowIcon();
return platform_observer_->ShouldShowTitleBar() && delegate &&
delegate->ShouldShowWindowIcon();
}
bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const {
......@@ -439,10 +437,8 @@ bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const {
// a window is being destroyed.
// See more discussion at http://crosbug.com/8958
views::WidgetDelegate* delegate = frame()->widget_delegate();
// ShouldShowTitleBar defaults to true.
if (platform_observer_ && !platform_observer_->ShouldShowTitleBar())
return false;
return delegate && delegate->ShouldShowWindowTitle();
return platform_observer_->ShouldShowTitleBar() && delegate &&
delegate->ShouldShowWindowTitle();
}
base::string16 OpaqueBrowserFrameView::GetWindowTitle() const {
......@@ -470,8 +466,6 @@ gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const {
bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const {
if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons())
return false;
if (!platform_observer_)
return true;
return platform_observer_->ShouldShowCaptionButtons();
}
......
......@@ -13,7 +13,7 @@ OpaqueBrowserFrameViewPlatformSpecific*
OpaqueBrowserFrameViewPlatformSpecific::Create(
OpaqueBrowserFrameView* view,
OpaqueBrowserFrameViewLayout* layout) {
return 0;
return new OpaqueBrowserFrameViewPlatformSpecific();
}
#endif
......
......@@ -13,8 +13,7 @@ class OpaqueBrowserFrameViewPlatformSpecific {
public:
virtual ~OpaqueBrowserFrameViewPlatformSpecific() {}
// Builds an observer for |view| and |layout|. This method returns NULL on
// platforms which don't need configuration.
// Builds an observer for |view| and |layout|.
static OpaqueBrowserFrameViewPlatformSpecific* Create(
OpaqueBrowserFrameView* view,
OpaqueBrowserFrameViewLayout* layout);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment