Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4461)

Unified Diff: chrome/browser/ui/views/frame/browser_frame_win.cc

Issue 7036014: Consolidate ShouldUseNativeFrame/AlwaysUseNativeFrame/UseNativeFrame spaghetti. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_frame_win.cc
===================================================================
--- chrome/browser/ui/views/frame/browser_frame_win.cc (revision 85647)
+++ chrome/browser/ui/views/frame/browser_frame_win.cc (working copy)
@@ -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 @@
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 @@
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::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 };

Powered by Google App Engine
This is Rietveld 408576698