diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 20:20:00 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 20:20:00 +0000 |
commit | e941a283e5b107f0c0a3595d0b6e11d7259d833f (patch) | |
tree | 27f886fcad4f9ef980e3638dfbc00ccf5f96a868 /chrome | |
parent | c4bdfe6586f6dd43c69102e4306872da504a1942 (diff) | |
download | chromium_src-e941a283e5b107f0c0a3595d0b6e11d7259d833f.zip chromium_src-e941a283e5b107f0c0a3595d0b6e11d7259d833f.tar.gz chromium_src-e941a283e5b107f0c0a3595d0b6e11d7259d833f.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
28 files changed, 76 insertions, 88 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index b149d62..3bf6071 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -54,6 +54,7 @@ #define IDC_SEARCH 34035 #define IDC_TABPOSE 34036 #define IDC_COMPACT_NAVBAR 34037 +#define IDC_DEBUG_FRAME_TOGGLE 34038 // Page-related commands #define IDC_BOOKMARK_PAGE 35000 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 2932112..e6f0640 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(); + return new PopupNonClientFrameView(frame); 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 56ac022..36033cf 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -932,7 +932,11 @@ bool ExternalTabContainer::DrawInfoBarArrows(int* x) const { } // ExternalTabContainer instances do not have a window. -views::Window* ExternalTabContainer::GetWindow() { +views::Window* ExternalTabContainer::GetContainingWindow() { + return NULL; +} + +const views::Window* ExternalTabContainer::GetContainingWindow() const { return NULL; } diff --git a/chrome/browser/external_tab_container_win.h b/chrome/browser/external_tab_container_win.h index 4a3ac39..6239386 100644 --- a/chrome/browser/external_tab_container_win.h +++ b/chrome/browser/external_tab_container_win.h @@ -187,7 +187,8 @@ class ExternalTabContainer : public TabContentsDelegate, static scoped_refptr<ExternalTabContainer> RemovePendingTab(uintptr_t cookie); // Overridden from views::WidgetWin: - virtual views::Window* GetWindow(); + virtual views::Window* GetContainingWindow() OVERRIDE; + virtual const views::Window* GetContainingWindow() const OVERRIDE; // 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 a9619cf..cbbb22f 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -3740,6 +3740,7 @@ 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 ee035f2..d90c4ac 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -141,6 +141,7 @@ 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)); @@ -201,10 +202,6 @@ 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(); @@ -215,10 +212,6 @@ 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 e1303e8..756a2bc 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.h +++ b/chrome/browser/ui/panels/panel_browser_frame_view.h @@ -42,8 +42,6 @@ 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 ef8f72c..4d63c11 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -155,7 +155,6 @@ 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; @@ -273,6 +272,10 @@ 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)); @@ -299,12 +302,6 @@ 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 3f25d88..68816a2 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,6 +65,8 @@ 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)); @@ -124,14 +126,6 @@ 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 f13496d..c896f9f 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,8 +41,6 @@ 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 0b0842e..3deb8e3 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc @@ -69,22 +69,6 @@ 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_; } @@ -120,7 +104,7 @@ views::RootView* BrowserFrame::CreateRootView() { views::NonClientFrameView* BrowserFrame::CreateFrameViewForWindow() { #if defined(OS_WIN) - if (AlwaysUseNativeFrame()) { + if (ShouldUseNativeFrame()) { 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 2c07fd2..8747bed 100644 --- a/chrome/browser/ui/views/frame/browser_frame.h +++ b/chrome/browser/ui/views/frame/browser_frame.h @@ -61,11 +61,6 @@ 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 1982d43..808cd39a3 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.cc +++ b/chrome/browser/ui/views/frame/browser_frame_win.cc @@ -13,6 +13,7 @@ #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" @@ -64,7 +65,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()->non_client_view()->UseNativeFrame() || + if (!GetWindow()->ShouldUseNativeFrame() || !browser_view_->IsBrowserTypeNormal()) { return WindowWin::GetClientAreaInsets(); } @@ -119,6 +120,24 @@ 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: @@ -151,7 +170,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_->AlwaysUseNativeFrame()) + if (!GetWindow()->client_view() || !browser_frame_->ShouldUseNativeFrame()) 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 d7249f4..499b15c 100644 --- a/chrome/browser/ui/views/frame/browser_frame_win.h +++ b/chrome/browser/ui/views/frame/browser_frame_win.h @@ -43,6 +43,7 @@ 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 cda4b37..2d82fa0 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(); + return new PopupNonClientFrameView(frame); 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 1f6dee6..18732f9 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1554,7 +1554,10 @@ 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); @@ -1801,7 +1804,7 @@ void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { SkColor BrowserView::GetInfoBarSeparatorColor() const { // NOTE: Keep this in sync with ToolbarView::OnPaint()! - return (IsTabStripVisible() || !frame_->non_client_view()->UseNativeFrame()) ? + return (IsTabStripVisible() || !frame_->ShouldUseNativeFrame()) ? ResourceBundle::toolbar_separator_color : SK_ColorBLACK; } @@ -2356,6 +2359,7 @@ 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). } @@ -2396,6 +2400,16 @@ 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 b15312f..150739f 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -523,6 +523,9 @@ 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 11e2950..d5dd6aa8 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -171,10 +171,6 @@ 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 4137648..fcec367 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h @@ -35,7 +35,6 @@ 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 7efd98b..a81140e 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -336,14 +336,6 @@ 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 9cc00e3..03ef113 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h @@ -79,8 +79,6 @@ 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 cd075d9..c2e6f63 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,6 +4,7 @@ #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" @@ -12,16 +13,12 @@ #include "views/window/hit_test.h" #endif -gfx::Rect PopupNonClientFrameView::GetBoundsForClientView() const { - return gfx::Rect(0, 0, width(), height()); -} - -bool PopupNonClientFrameView::AlwaysUseCustomFrame() const { - return false; +PopupNonClientFrameView::PopupNonClientFrameView(BrowserFrame* frame) { + frame->set_frame_type(views::Window::FRAME_TYPE_FORCE_NATIVE); } -bool PopupNonClientFrameView::AlwaysUseNativeFrame() const { - return true; +gfx::Rect PopupNonClientFrameView::GetBoundsForClientView() const { + return gfx::Rect(0, 0, width(), height()); } gfx::Rect PopupNonClientFrameView::GetWindowBoundsForClientBounds( 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 abd4875..d15cd9b 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,12 +13,10 @@ // nothing. class PopupNonClientFrameView : public BrowserNonClientFrameView { public: - PopupNonClientFrameView() {} + explicit PopupNonClientFrameView(BrowserFrame* frame); // 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 e3f62d2..4d3ab10 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()->non_client_view()->UseNativeFrame()) { + GetWidget()->GetContainingWindow()->ShouldUseNativeFrame()) { 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 15790fa..6c014cc 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()->non_client_view()->UseNativeFrame()) { + if (GetWindow()->ShouldUseNativeFrame()) { 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 b45c46a..adc3786b 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()->non_client_view()->UseNativeFrame() ? + (GetWindow()->ShouldUseNativeFrame() ? 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()->non_client_view()->UseNativeFrame()) + if (GetWindow()->ShouldUseNativeFrame()) 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->non_client_view()->UseNativeFrame() ? + return window && window->ShouldUseNativeFrame() ? 0 : kPopupTopSpacingNonGlass; } diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 4afe3a8..220818d 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -150,6 +150,10 @@ const char kCountry[] = "country"; // without having to restart the browser). const char kDebugDevToolsFrontend[] = "debug-devtools-frontend"; +// Enables a frame context menu item that toggles the frame in and out of glass +// mode (Windows Vista and up only). +const char kDebugEnableFrameToggle[] = "debug-enable-frame-toggle"; + // Enables support to debug printing subsystem. const char kDebugPrint[] = "debug-print"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index aa4cb99..b39a415 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -57,6 +57,7 @@ extern const char kCloudPrintServiceURL[]; extern const char kConflictingModulesCheck[]; extern const char kCountry[]; extern const char kDebugDevToolsFrontend[]; +extern const char kDebugEnableFrameToggle[]; extern const char kDebugPrint[]; extern const char kDeviceManagementUrl[]; extern const char kDiagnostics[]; |