summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 00:15:37 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-18 00:15:37 +0000
commit41b946d3b39411c505f66a9dba6dc052d80dde88 (patch)
tree4dcca83abfc727b02d2fc55fb97d1fc74ee9283e /chrome/browser
parent88df2dcb0c27fcc59835d72d35960d6da6649655 (diff)
downloadchromium_src-41b946d3b39411c505f66a9dba6dc052d80dde88.zip
chromium_src-41b946d3b39411c505f66a9dba6dc052d80dde88.tar.gz
chromium_src-41b946d3b39411c505f66a9dba6dc052d80dde88.tar.bz2
Revert 85666 - Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti.
Now there is: ... window::ShouldUseNativeFrame() Which is basically just a pass-thru to WindowWin::ShouldUseNativeFrame() ... which can be overridden by subclasses. Native-Frame is a windows-only concept but keeping the API on Window means I don't have to update a lot of call sites. Window also gains a FrameType state member that toggles three states - default, force-native and force-custom. This supercedes the "AlwaysUseNativeFrame/AlwaysUseCustomFrame" methods on NonClientView. I have also hooked up a context menu item behind a command line flag --debug-enable-frame-toggle that allows the frame type for an individual window to be toggled, useful for debugging. BUG=none TEST=none Review URL: http://codereview.chromium.org/7036014 TBR=ben@chromium.org Review URL: http://codereview.chromium.org/6975037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc2
-rw-r--r--chrome/browser/external_tab_container_win.cc6
-rw-r--r--chrome/browser/external_tab_container_win.h3
-rw-r--r--chrome/browser/ui/browser.cc1
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.cc9
-rw-r--r--chrome/browser/ui/panels/panel_browser_frame_view.h2
-rw-r--r--chrome/browser/ui/views/constrained_window_views.cc11
-rw-r--r--chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc10
-rw-r--r--chrome/browser/ui/views/frame/app_panel_browser_frame_view.h2
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.cc18
-rw-r--r--chrome/browser/ui/views/frame/browser_frame.h5
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.cc23
-rw-r--r--chrome/browser/ui/views/frame/browser_frame_win.h1
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_gtk.cc2
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc18
-rw-r--r--chrome/browser/ui/views/frame/browser_view.h3
-rw-r--r--chrome/browser/ui/views/frame/glass_browser_frame_view.cc4
-rw-r--r--chrome/browser/ui/views/frame/glass_browser_frame_view.h1
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.cc8
-rw-r--r--chrome/browser/ui/views/frame/opaque_browser_frame_view.h2
-rw-r--r--chrome/browser/ui/views/frame/popup_non_client_frame_view.cc13
-rw-r--r--chrome/browser/ui/views/frame/popup_non_client_frame_view.h4
-rw-r--r--chrome/browser/ui/views/tabs/tab.cc2
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.cc2
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc6
25 files changed, 88 insertions, 70 deletions
diff --git a/chrome/browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc b/chrome/browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc
index e6f0640..2932112 100644
--- a/chrome/browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc
+++ b/chrome/browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc
@@ -13,7 +13,7 @@ namespace browser {
BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
BrowserFrame* frame, BrowserView* browser_view) {
if (browser_view->IsBrowserTypePopup() || browser_view->IsBrowserTypePanel())
- return new PopupNonClientFrameView(frame);
+ return new PopupNonClientFrameView();
else
return new chromeos::BrowserFrameViewChromeos(frame, browser_view);
}
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 36033cf..56ac022 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -932,11 +932,7 @@ bool ExternalTabContainer::DrawInfoBarArrows(int* x) const {
}
// ExternalTabContainer instances do not have a window.
-views::Window* ExternalTabContainer::GetContainingWindow() {
- return NULL;
-}
-
-const views::Window* ExternalTabContainer::GetContainingWindow() const {
+views::Window* ExternalTabContainer::GetWindow() {
return NULL;
}
diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h
index 6239386..4a3ac39 100644
--- a/chrome/browser/external_tab_container_win.h
+++ b/chrome/browser/external_tab_container_win.h
@@ -187,8 +187,7 @@ class ExternalTabContainer : public TabContentsDelegate,
static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie);
// Overridden from views::WidgetWin:
- virtual views::Window* GetContainingWindow() OVERRIDE;
- virtual const views::Window* GetContainingWindow() const OVERRIDE;
+ virtual views::Window* GetWindow();
// Handles the specified |accelerator| being pressed.
bool AcceleratorPressed(const views::Accelerator& accelerator);
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index cbbb22f..a9619cf 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -3740,7 +3740,6 @@ void Browser::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, false);
command_updater_.UpdateCommandEnabled(IDC_EXIT, true);
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, true);
- command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true);
// Page-related commands
command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, true);
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc
index d90c4ac..ee035f2 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc
@@ -141,7 +141,6 @@ PanelBrowserFrameView::PanelBrowserFrameView(BrowserFrame* frame,
title_icon_(NULL),
title_label_(NULL) {
EnsureResourcesInitialized();
- frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
options_button_ = new views::MenuButton(NULL, std::wstring(), this, false);
options_button_->SetIcon(*(options_button_resources.normal_image));
@@ -202,6 +201,10 @@ gfx::Rect PanelBrowserFrameView::GetBoundsForClientView() const {
return client_view_bounds_;
}
+bool PanelBrowserFrameView::AlwaysUseCustomFrame() const {
+ return true;
+}
+
gfx::Rect PanelBrowserFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
int top_height = NonClientTopBorderHeight();
@@ -212,6 +215,10 @@ gfx::Rect PanelBrowserFrameView::GetWindowBoundsForClientBounds(
client_bounds.height() + top_height + border_thickness);
}
+bool PanelBrowserFrameView::AlwaysUseNativeFrame() const {
+ return frame_->AlwaysUseNativeFrame();
+}
+
int PanelBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
if (!bounds().Contains(point))
return HTNOWHERE;
diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.h b/chrome/browser/ui/panels/panel_browser_frame_view.h
index 756a2bc..e1303e8 100644
--- a/chrome/browser/ui/panels/panel_browser_frame_view.h
+++ b/chrome/browser/ui/panels/panel_browser_frame_view.h
@@ -42,6 +42,8 @@ class PanelBrowserFrameView : public BrowserNonClientFrameView,
// Overridden from views::NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
+ virtual bool AlwaysUseCustomFrame() const OVERRIDE;
+ virtual bool AlwaysUseNativeFrame() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index 4d63c11..ef8f72c 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -155,6 +155,7 @@ class ConstrainedWindowFrameView
// Overridden from views::NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
+ virtual bool AlwaysUseCustomFrame() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
@@ -272,10 +273,6 @@ ConstrainedWindowFrameView::ConstrainedWindowFrameView(
InitClass();
InitWindowResources();
- // Constrained windows always use the custom frame - they just have a
- // different set of bitmaps.
- container->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
-
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_CLOSE_SA));
@@ -302,6 +299,12 @@ gfx::Rect ConstrainedWindowFrameView::GetBoundsForClientView() const {
return client_view_bounds_;
}
+bool ConstrainedWindowFrameView::AlwaysUseCustomFrame() const {
+ // Constrained windows always use the custom frame - they just have a
+ // different set of bitmaps.
+ return true;
+}
+
gfx::Rect ConstrainedWindowFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
int top_height = NonClientTopBorderHeight();
diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
index 68816a2..3f25d88 100644
--- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
@@ -65,8 +65,6 @@ AppPanelBrowserFrameView::AppPanelBrowserFrameView(BrowserFrame* frame,
DCHECK(browser_view->ShouldShowWindowIcon());
DCHECK(browser_view->ShouldShowWindowTitle());
- frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM);
-
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::BS_NORMAL,
rb.GetBitmapNamed(IDR_CLOSE_BAR));
@@ -126,6 +124,14 @@ gfx::Rect AppPanelBrowserFrameView::GetBoundsForClientView() const {
return client_view_bounds_;
}
+bool AppPanelBrowserFrameView::AlwaysUseCustomFrame() const {
+ return true;
+}
+
+bool AppPanelBrowserFrameView::AlwaysUseNativeFrame() const {
+ return frame_->AlwaysUseNativeFrame();
+}
+
gfx::Rect AppPanelBrowserFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
int top_height = NonClientTopBorderHeight();
diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h
index c896f9f..f13496d 100644
--- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.h
@@ -41,6 +41,8 @@ class AppPanelBrowserFrameView : public BrowserNonClientFrameView,
protected:
// Overridden from views::NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
+ virtual bool AlwaysUseCustomFrame() const OVERRIDE;
+ virtual bool AlwaysUseNativeFrame() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc
index 3deb8e3..0b0842e 100644
--- a/chrome/browser/ui/views/frame/browser_frame.cc
+++ b/chrome/browser/ui/views/frame/browser_frame.cc
@@ -69,6 +69,22 @@ void BrowserFrame::UpdateThrobber(bool running) {
browser_frame_view_->UpdateThrobber(running);
}
+bool BrowserFrame::AlwaysUseNativeFrame() const {
+ // App panel windows draw their own frame.
+ if (browser_view_->IsBrowserTypePanel())
+ 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() && 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 GetThemeProvider()->ShouldUseNativeFrame();
+}
+
views::View* BrowserFrame::GetFrameView() const {
return browser_frame_view_;
}
@@ -104,7 +120,7 @@ views::RootView* BrowserFrame::CreateRootView() {
views::NonClientFrameView* BrowserFrame::CreateFrameViewForWindow() {
#if defined(OS_WIN)
- if (ShouldUseNativeFrame()) {
+ if (AlwaysUseNativeFrame()) {
browser_frame_view_ = new GlassBrowserFrameView(this, browser_view_);
} else {
#endif
diff --git a/chrome/browser/ui/views/frame/browser_frame.h b/chrome/browser/ui/views/frame/browser_frame.h
index 8747bed..2c07fd2 100644
--- a/chrome/browser/ui/views/frame/browser_frame.h
+++ b/chrome/browser/ui/views/frame/browser_frame.h
@@ -61,6 +61,11 @@ class BrowserFrame : public views::Window {
// Tells the frame to update the throbber.
void UpdateThrobber(bool running);
+ // Returns true if the window should use the native frame view. This is true
+ // if there are no themes applied on Vista, or if there are themes applied and
+ // this browser window is an app or popup.
+ bool AlwaysUseNativeFrame() const;
+
// Returns the NonClientFrameView of this frame.
views::View* GetFrameView() const;
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc
index 808cd39a3..1982d43 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_win.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "grit/theme_resources.h"
-#include "ui/base/theme_provider.h"
#include "ui/gfx/font.h"
#include "views/screen.h"
#include "views/window/non_client_view.h"
@@ -65,7 +64,7 @@ int BrowserFrameWin::GetShowState() const {
gfx::Insets BrowserFrameWin::GetClientAreaInsets() const {
// Use the default client insets for an opaque frame or a glass popup/app
// frame.
- if (!GetWindow()->ShouldUseNativeFrame() ||
+ if (!GetWindow()->non_client_view()->UseNativeFrame() ||
!browser_view_->IsBrowserTypeNormal()) {
return WindowWin::GetClientAreaInsets();
}
@@ -120,24 +119,6 @@ void BrowserFrameWin::OnScreenReaderDetected() {
WindowWin::OnScreenReaderDetected();
}
-bool BrowserFrameWin::ShouldUseNativeFrame() const {
- // App panel windows draw their own frame.
- if (browser_view_->IsBrowserTypePanel())
- 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() &&
- WindowWin::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();
-}
-
////////////////////////////////////////////////////////////////////////////////
// BrowserFrameWin, NativeBrowserFrame implementation:
@@ -170,7 +151,7 @@ void BrowserFrameWin::TabStripDisplayModeChanged() {
void BrowserFrameWin::UpdateDWMFrame() {
// Nothing to do yet, or we're not showing a DWM frame.
- if (!GetWindow()->client_view() || !browser_frame_->ShouldUseNativeFrame())
+ if (!GetWindow()->client_view() || !browser_frame_->AlwaysUseNativeFrame())
return;
MARGINS margins = { 0 };
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.h b/chrome/browser/ui/views/frame/browser_frame_win.h
index 499b15c..d7249f4 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.h
+++ b/chrome/browser/ui/views/frame/browser_frame_win.h
@@ -43,7 +43,6 @@ class BrowserFrameWin : public views::WindowWin,
BOOL is_system_menu) OVERRIDE;
virtual void OnWindowPosChanged(WINDOWPOS* window_pos) OVERRIDE;
virtual void OnScreenReaderDetected() OVERRIDE;
- virtual bool ShouldUseNativeFrame() const OVERRIDE;
// Overridden from NativeBrowserFrame:
virtual views::NativeWindow* AsNativeWindow() OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_gtk.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_gtk.cc
index 2d82fa0..cda4b37 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_gtk.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_gtk.cc
@@ -13,7 +13,7 @@ namespace browser {
BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
BrowserFrame* frame, BrowserView* browser_view) {
if (browser_view->IsBrowserTypePopup() || browser_view->IsBrowserTypePanel())
- return new PopupNonClientFrameView(frame);
+ return new PopupNonClientFrameView();
else
return new OpaqueBrowserFrameView(frame, browser_view);
}
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 18732f9..1f6dee6 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1554,10 +1554,7 @@ bool BrowserView::ShouldShowWindowIcon() const {
bool BrowserView::ExecuteWindowsCommand(int command_id) {
// This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND.
-#if defined(OS_WIN)
- if (command_id == IDC_DEBUG_FRAME_TOGGLE)
- GetWindow()->DebugToggleFrameType();
-#endif
+
// Translate WM_APPCOMMAND command ids into a command id that the browser
// knows how to handle.
int command_id_from_app_command = GetCommandIDForAppCommandID(command_id);
@@ -1804,7 +1801,7 @@ void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) {
SkColor BrowserView::GetInfoBarSeparatorColor() const {
// NOTE: Keep this in sync with ToolbarView::OnPaint()!
- return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ?
+ return (IsTabStripVisible() || !frame_->non_client_view()->UseNativeFrame()) ?
ResourceBundle::toolbar_separator_color : SK_ColorBLACK;
}
@@ -2359,7 +2356,6 @@ void BrowserView::BuildSystemMenuForBrowserWindow() {
system_menu_contents_->AddSeparator();
system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
- AddFrameToggleItems();
// If it's a regular browser window with tabs, we don't add any more items,
// since it already has menus (Page, Chrome).
}
@@ -2400,16 +2396,6 @@ void BrowserView::BuildSystemMenuForAppOrPopupWindow() {
IDS_CONTENT_CONTEXT_FORWARD);
system_menu_contents_->AddItemWithStringId(IDC_BACK,
IDS_CONTENT_CONTEXT_BACK);
- AddFrameToggleItems();
-}
-
-void BrowserView::AddFrameToggleItems() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDebugEnableFrameToggle)) {
- system_menu_contents_->AddSeparator();
- system_menu_contents_->AddItem(IDC_DEBUG_FRAME_TOGGLE,
- L"Toggle Frame Type");
- }
}
#endif
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 150739f..b15312f 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -523,9 +523,6 @@ class BrowserView : public BrowserBubbleHost,
// Builds the correct menu for when we have minimal chrome.
void BuildSystemMenuForBrowserWindow();
void BuildSystemMenuForAppOrPopupWindow();
-
- // Adds optional debug items for frame type toggling.
- void AddFrameToggleItems();
#endif
// Retrieves the command id for the specified Windows app command.
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index d5dd6aa8..11e2950 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -171,6 +171,10 @@ gfx::Rect GlassBrowserFrameView::GetBoundsForClientView() const {
return client_view_bounds_;
}
+bool GlassBrowserFrameView::AlwaysUseNativeFrame() const {
+ return frame_->AlwaysUseNativeFrame();
+}
+
gfx::Rect GlassBrowserFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
HWND hwnd = frame_->GetNativeWindow();
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h
index fcec367..4137648 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h
@@ -35,6 +35,7 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView,
// Overridden from views::NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
+ virtual bool AlwaysUseNativeFrame() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index a81140e..7efd98b 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -336,6 +336,14 @@ gfx::Rect OpaqueBrowserFrameView::GetBoundsForClientView() const {
return client_view_bounds_;
}
+bool OpaqueBrowserFrameView::AlwaysUseNativeFrame() const {
+ return frame_->AlwaysUseNativeFrame();
+}
+
+bool OpaqueBrowserFrameView::AlwaysUseCustomFrame() const {
+ return true;
+}
+
gfx::Rect OpaqueBrowserFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
int top_height = NonClientTopBorderHeight(false, false);
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
index 03ef113..9cc00e3 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h
@@ -79,6 +79,8 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView,
// Overridden from views::NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
+ virtual bool AlwaysUseNativeFrame() const OVERRIDE;
+ virtual bool AlwaysUseCustomFrame() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
diff --git a/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc b/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
index c2e6f63..cd075d9 100644
--- a/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/popup_non_client_frame_view.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/frame/popup_non_client_frame_view.h"
-#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -13,14 +12,18 @@
#include "views/window/hit_test.h"
#endif
-PopupNonClientFrameView::PopupNonClientFrameView(BrowserFrame* frame) {
- frame->set_frame_type(views::Window::FRAME_TYPE_FORCE_NATIVE);
-}
-
gfx::Rect PopupNonClientFrameView::GetBoundsForClientView() const {
return gfx::Rect(0, 0, width(), height());
}
+bool PopupNonClientFrameView::AlwaysUseCustomFrame() const {
+ return false;
+}
+
+bool PopupNonClientFrameView::AlwaysUseNativeFrame() const {
+ return true;
+}
+
gfx::Rect PopupNonClientFrameView::GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const {
return client_bounds;
diff --git a/chrome/browser/ui/views/frame/popup_non_client_frame_view.h b/chrome/browser/ui/views/frame/popup_non_client_frame_view.h
index d15cd9b..abd4875 100644
--- a/chrome/browser/ui/views/frame/popup_non_client_frame_view.h
+++ b/chrome/browser/ui/views/frame/popup_non_client_frame_view.h
@@ -13,10 +13,12 @@
// nothing.
class PopupNonClientFrameView : public BrowserNonClientFrameView {
public:
- explicit PopupNonClientFrameView(BrowserFrame* frame);
+ PopupNonClientFrameView() {}
// NonClientFrameView:
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
+ virtual bool AlwaysUseCustomFrame() const OVERRIDE;
+ virtual bool AlwaysUseNativeFrame() const OVERRIDE;
virtual gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const OVERRIDE;
virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 4d3ab10..e3f62d2 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -450,7 +450,7 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
int tab_id;
if (GetWidget() &&
- GetWidget()->GetContainingWindow()->ShouldUseNativeFrame()) {
+ GetWidget()->GetContainingWindow()->non_client_view()->UseNativeFrame()) {
tab_id = IDR_THEME_TAB_BACKGROUND_V;
} else {
tab_id = data().incognito ? IDR_THEME_TAB_BACKGROUND_INCOGNITO :
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 6c014cc..15790fa 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -302,7 +302,7 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) {
}
}
- if (GetWindow()->ShouldUseNativeFrame()) {
+ if (GetWindow()->non_client_view()->UseNativeFrame()) {
bool multiple_tabs_selected = (!selected_tabs.empty() ||
tabs_dragging.size() > 1);
// Make sure non-active tabs are somewhat transparent.
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index adc3786b..b45c46a 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -466,7 +466,7 @@ gfx::Size ToolbarView::GetPreferredSize() {
}
int vertical_spacing = PopupTopSpacing() +
- (GetWindow()->ShouldUseNativeFrame() ?
+ (GetWindow()->non_client_view()->UseNativeFrame() ?
kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass);
return gfx::Size(0, location_bar_->GetPreferredSize().height() +
vertical_spacing);
@@ -566,7 +566,7 @@ void ToolbarView::OnPaint(gfx::Canvas* canvas) {
// it from the content area. For non-glass, the NonClientView draws the
// toolbar background below the location bar for us.
// NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()!
- if (GetWindow()->ShouldUseNativeFrame())
+ if (GetWindow()->non_client_view()->UseNativeFrame())
canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1);
}
@@ -646,7 +646,7 @@ int ToolbarView::PopupTopSpacing() const {
// it's possible the crash may just show up somewhere else.
const views::Window* window = GetWindow();
DCHECK(window) << "If you hit this please talk to beng";
- return window && window->ShouldUseNativeFrame() ?
+ return window && window->non_client_view()->UseNativeFrame() ?
0 : kPopupTopSpacingNonGlass;
}