Commit fe18deba authored by ananta@chromium.org's avatar ananta@chromium.org

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

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 in the browser namespace
ShouldUseNativeFrame in the newly added files browser_frame_common_win.h/.cc. This is invoked from BrowserFrameWin
and from the BrowserDesktopRootWindowHostWin::ShouldUseNativeFrame override which is invoked via the
DesktopBrowserFrameAura::ShouldUseNativeFrame override for AURA

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182281 0039d316-1c4b-4281-b951-d872f2087c98
parent 71f4b278
......@@ -9,6 +9,7 @@
#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"
......@@ -16,6 +17,7 @@
#include "grit/theme_resources.h"
#include "ui/base/theme_provider.h"
#include "ui/views/controls/menu/native_menu_win.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#pragma comment(lib, "dwmapi.lib")
......@@ -223,6 +225,12 @@ bool BrowserDesktopRootWindowHostWin::IsUsingCustomFrame() const {
return !GetWidget()->GetThemeProvider()->ShouldUseNativeFrame();
}
bool BrowserDesktopRootWindowHostWin::ShouldUseNativeFrame() {
return chrome::ShouldUseNativeFrame(desktop_native_widget_aura(),
browser_view_,
GetWidget()->GetThemeProvider());
}
////////////////////////////////////////////////////////////////////////////////
// BrowserDesktopRootWindowHostWin, private:
......
......@@ -48,6 +48,7 @@ class BrowserDesktopRootWindowHostWin : public BrowserDesktopRootWindowHost,
WPARAM w_param,
LPARAM l_param) OVERRIDE;
virtual bool IsUsingCustomFrame() const OVERRIDE;
virtual bool ShouldUseNativeFrame() OVERRIDE;
void UpdateDWMFrame();
......
// 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"
#include "ui/views/widget/native_widget_private.h"
namespace chrome {
bool ShouldUseNativeFrame(
const views::internal::NativeWidgetPrivate* native_widget,
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() &&
native_widget->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 theme_provider->ShouldUseNativeFrame();
}
} // namespace browser
// 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;
class NativeWidget;
namespace ui {
class ThemeProvider;
}
namespace views {
namespace internal {
class NativeWidgetPrivate;
}
}
namespace chrome {
// Returns true if we should use the native i.e. Glass browser frame.
// for the BrowserView passed in.
bool ShouldUseNativeFrame(
const views::internal::NativeWidgetPrivate* native_widget,
const BrowserView* browser_view,
const ui::ThemeProvider* theme_provider);
}
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_COMMON_WIN_H_
......@@ -20,6 +20,7 @@
#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"
......@@ -276,21 +277,9 @@ void BrowserFrameWin::OnScreenReaderDetected() {
}
bool BrowserFrameWin::ShouldUseNativeFrame() const {
// 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() &&
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(this,
browser_view_,
GetWidget()->GetThemeProvider());
}
void BrowserFrameWin::Show() {
......
......@@ -1523,6 +1523,8 @@
'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',
......
......@@ -200,6 +200,10 @@ class VIEWS_EXPORT DesktopRootWindowHostWin
const Widget* GetWidget() const;
HWND GetHWND() const;
const DesktopNativeWidgetAura* desktop_native_widget_aura() const {
return desktop_native_widget_aura_;
}
private:
// We are owned by the RootWindow, but we have to have a back pointer to it.
aura::RootWindow* root_window_;
......
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