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

Side by Side Diff: chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.cc

Issue 12251010: Ensure that when themes in desktop chrome AURA on Windows use the opaque browser frame view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.h" 5 #include "chrome/browser/ui/views/frame/browser_desktop_root_window_host_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/themes/theme_service_factory.h" 10 #include "chrome/browser/themes/theme_service_factory.h"
11 #include "chrome/browser/ui/views/frame/browser_frame.h" 11 #include "chrome/browser/ui/views/frame/browser_frame.h"
12 #include "chrome/browser/ui/views/frame/browser_frame_common_win.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h" 14 #include "chrome/browser/ui/views/frame/system_menu_insertion_delegate_win.h"
14 #include "chrome/browser/ui/views/tabs/tab_strip.h" 15 #include "chrome/browser/ui/views/tabs/tab_strip.h"
15 #include "chrome/browser/ui/views/theme_image_mapper.h" 16 #include "chrome/browser/ui/views/theme_image_mapper.h"
16 #include "grit/theme_resources.h" 17 #include "grit/theme_resources.h"
17 #include "ui/base/theme_provider.h" 18 #include "ui/base/theme_provider.h"
18 #include "ui/views/controls/menu/native_menu_win.h" 19 #include "ui/views/controls/menu/native_menu_win.h"
20 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
19 21
20 #pragma comment(lib, "dwmapi.lib") 22 #pragma comment(lib, "dwmapi.lib")
21 23
22 namespace { 24 namespace {
23 25
24 const int kClientEdgeThickness = 3; 26 const int kClientEdgeThickness = 3;
25 // We need to offset the DWMFrame into the toolbar so that the blackness 27 // We need to offset the DWMFrame into the toolbar so that the blackness
26 // doesn't show up on our rounded corners. 28 // doesn't show up on our rounded corners.
27 const int kDWMFrameTopOffset = 3; 29 const int kDWMFrameTopOffset = 3;
28 30
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if (!browser_view_->IsBrowserTypeNormal() && 218 if (!browser_view_->IsBrowserTypeNormal() &&
217 !DesktopRootWindowHostWin::IsUsingCustomFrame()) { 219 !DesktopRootWindowHostWin::IsUsingCustomFrame()) {
218 return false; 220 return false;
219 } 221 }
220 222
221 // Otherwise, we use the native frame when we're told we should by the theme 223 // Otherwise, we use the native frame when we're told we should by the theme
222 // provider (e.g. no custom theme is active). 224 // provider (e.g. no custom theme is active).
223 return !GetWidget()->GetThemeProvider()->ShouldUseNativeFrame(); 225 return !GetWidget()->GetThemeProvider()->ShouldUseNativeFrame();
224 } 226 }
225 227
228 bool BrowserDesktopRootWindowHostWin::ShouldUseNativeFrame() {
229 return chrome::ShouldUseNativeFrame(desktop_native_widget_aura(),
230 browser_view_,
231 GetWidget()->GetThemeProvider());
232 }
233
226 //////////////////////////////////////////////////////////////////////////////// 234 ////////////////////////////////////////////////////////////////////////////////
227 // BrowserDesktopRootWindowHostWin, private: 235 // BrowserDesktopRootWindowHostWin, private:
228 236
229 void BrowserDesktopRootWindowHostWin::UpdateDWMFrame() { 237 void BrowserDesktopRootWindowHostWin::UpdateDWMFrame() {
230 // For "normal" windows on Aero, we always need to reset the glass area 238 // For "normal" windows on Aero, we always need to reset the glass area
231 // correctly, even if we're not currently showing the native frame (e.g. 239 // correctly, even if we're not currently showing the native frame (e.g.
232 // because a theme is showing), so we explicitly check for that case rather 240 // because a theme is showing), so we explicitly check for that case rather
233 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here 241 // than checking browser_frame_->ShouldUseNativeFrame() here. Using that here
234 // would mean we wouldn't reset the glass area to zero when moving from the 242 // would mean we wouldn't reset the glass area to zero when moving from the
235 // native frame to an opaque frame, leading to graphical glitches behind the 243 // native frame to an opaque frame, leading to graphical glitches behind the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 views::DesktopNativeWidgetAura* desktop_native_widget_aura, 283 views::DesktopNativeWidgetAura* desktop_native_widget_aura,
276 const gfx::Rect& initial_bounds, 284 const gfx::Rect& initial_bounds,
277 BrowserView* browser_view, 285 BrowserView* browser_view,
278 BrowserFrame* browser_frame) { 286 BrowserFrame* browser_frame) {
279 return new BrowserDesktopRootWindowHostWin(native_widget_delegate, 287 return new BrowserDesktopRootWindowHostWin(native_widget_delegate,
280 desktop_native_widget_aura, 288 desktop_native_widget_aura,
281 initial_bounds, 289 initial_bounds,
282 browser_view, 290 browser_view,
283 browser_frame); 291 browser_frame);
284 } 292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698