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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/views/constrained_window_views.h"
9 #include "chrome/browser/themes/theme_properties.h"
10 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/views/theme_image_mapper.h"
12 #include "components/web_modal/web_contents_modal_dialog_host.h"
13 #include "grit/theme_resources.h"
14 #include "grit/ui_resources.h"
15 #include "ui/base/hit_test.h"
16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/canvas.h"
18 #include "ui/gfx/font.h"
19 #include "ui/views/border.h"
20 #include "ui/views/color_constants.h"
21 #include "ui/views/controls/button/image_button.h"
22 #include "ui/views/widget/widget.h"
23 #include "ui/views/widget/widget_observer.h"
24 #include "ui/views/window/dialog_delegate.h"
25 #include "ui/views/window/frame_background.h"
26 #include "ui/views/window/window_resources.h"
27 #include "ui/views/window/window_shape.h"
29 #if defined(OS_WIN) && !defined(USE_AURA)
30 #include "ui/base/win/shell.h"
31 #include "ui/views/widget/native_widget_win.h"
35 #include "ui/aura/window.h"
39 #include "ash/wm/custom_frame_view_ash.h"
42 using web_modal::WebContentsModalDialogHost
;
43 using web_modal::WebContentsModalDialogHostObserver
;
46 // The name of a key to store on the window handle to associate
47 // WebContentsModalDialogHostObserverViews with the Widget.
48 const char* const kWebContentsModalDialogHostObserverViewsKey
=
49 "__WEB_CONTENTS_MODAL_DIALOG_HOST_OBSERVER_VIEWS__";
51 // Applies positioning changes from the WebContentsModalDialogHost to the
53 class WebContentsModalDialogHostObserverViews
54 : public views::WidgetObserver
,
55 public WebContentsModalDialogHostObserver
{
57 WebContentsModalDialogHostObserverViews(
58 WebContentsModalDialogHost
* host
,
59 views::Widget
* target_widget
,
60 const char *const native_window_property
)
62 target_widget_(target_widget
),
63 native_window_property_(native_window_property
) {
65 DCHECK(target_widget_
);
66 host_
->AddObserver(this);
67 target_widget_
->AddObserver(this);
70 virtual ~WebContentsModalDialogHostObserverViews() {
72 host_
->RemoveObserver(this);
73 target_widget_
->RemoveObserver(this);
74 target_widget_
->SetNativeWindowProperty(native_window_property_
,
78 // WidgetObserver overrides
79 virtual void OnWidgetClosing(views::Widget
* widget
) OVERRIDE
{
83 // WebContentsModalDialogHostObserver overrides
84 virtual void OnPositionRequiresUpdate() OVERRIDE
{
85 UpdateWebContentsModalDialogPosition(target_widget_
, host_
);
88 virtual void OnHostDestroying() OVERRIDE
{
89 host_
->RemoveObserver(this);
94 WebContentsModalDialogHost
* host_
;
95 views::Widget
* target_widget_
;
96 const char* const native_window_property_
;
98 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostObserverViews
);
103 // An enumeration of image resources used by this window.
105 FRAME_PART_IMAGE_FIRST
= 0, // Must be first.
107 // Window Frame Border.
109 FRAME_BOTTOM_LEFT_CORNER
,
110 FRAME_BOTTOM_RIGHT_CORNER
,
114 FRAME_TOP_LEFT_CORNER
,
115 FRAME_TOP_RIGHT_CORNER
,
117 FRAME_PART_IMAGE_COUNT
// Must be last.
120 static const int kXPFramePartIDs
[] = {
122 IDR_WINDOW_BOTTOM_CENTER
, IDR_WINDOW_BOTTOM_LEFT_CORNER
,
123 IDR_WINDOW_BOTTOM_RIGHT_CORNER
, IDR_WINDOW_LEFT_SIDE
,
124 IDR_WINDOW_RIGHT_SIDE
, IDR_WINDOW_TOP_CENTER
,
125 IDR_WINDOW_TOP_LEFT_CORNER
, IDR_WINDOW_TOP_RIGHT_CORNER
,
127 static const int kVistaFramePartIDs
[] = {
129 IDR_CONSTRAINED_BOTTOM_CENTER_V
, IDR_CONSTRAINED_BOTTOM_LEFT_CORNER_V
,
130 IDR_CONSTRAINED_BOTTOM_RIGHT_CORNER_V
, IDR_CONSTRAINED_LEFT_SIDE_V
,
131 IDR_CONSTRAINED_RIGHT_SIDE_V
, IDR_CONSTRAINED_TOP_CENTER_V
,
132 IDR_CONSTRAINED_TOP_LEFT_CORNER_V
, IDR_CONSTRAINED_TOP_RIGHT_CORNER_V
,
135 class XPWindowResources
: public views::WindowResources
{
137 XPWindowResources() {
140 virtual ~XPWindowResources() {}
142 virtual gfx::ImageSkia
* GetPartImage(
143 views::FramePartImage part_id
) const OVERRIDE
{
144 return images_
[part_id
];
148 static void InitClass() {
149 static bool initialized
= false;
151 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
152 for (int i
= 0; i
< FRAME_PART_IMAGE_COUNT
; ++i
) {
153 int id
= kXPFramePartIDs
[i
];
155 images_
[i
] = rb
.GetImageSkiaNamed(id
);
161 static gfx::ImageSkia
* images_
[FRAME_PART_IMAGE_COUNT
];
163 DISALLOW_COPY_AND_ASSIGN(XPWindowResources
);
166 class VistaWindowResources
: public views::WindowResources
{
168 VistaWindowResources() {
171 virtual ~VistaWindowResources() {}
173 virtual gfx::ImageSkia
* GetPartImage(
174 views::FramePartImage part_id
) const OVERRIDE
{
175 return images_
[part_id
];
179 static void InitClass() {
180 static bool initialized
= false;
182 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
183 for (int i
= 0; i
< FRAME_PART_IMAGE_COUNT
; ++i
) {
184 int id
= kVistaFramePartIDs
[i
];
186 images_
[i
] = rb
.GetImageSkiaNamed(id
);
192 static gfx::ImageSkia
* images_
[FRAME_PART_IMAGE_COUNT
];
194 DISALLOW_COPY_AND_ASSIGN(VistaWindowResources
);
197 gfx::ImageSkia
* XPWindowResources::images_
[];
198 gfx::ImageSkia
* VistaWindowResources::images_
[];
200 class ConstrainedWindowFrameView
: public views::NonClientFrameView
,
201 public views::ButtonListener
{
203 ConstrainedWindowFrameView(views::Widget
* container
,
204 bool browser_is_off_the_record
);
205 virtual ~ConstrainedWindowFrameView();
207 virtual void UpdateWindowTitle() OVERRIDE
;
209 // Overridden from views::NonClientFrameView:
210 virtual gfx::Rect
GetBoundsForClientView() const OVERRIDE
;
211 virtual gfx::Rect
GetWindowBoundsForClientBounds(
212 const gfx::Rect
& client_bounds
) const OVERRIDE
;
213 virtual int NonClientHitTest(const gfx::Point
& point
) OVERRIDE
;
214 virtual void GetWindowMask(const gfx::Size
& size
,
215 gfx::Path
* window_mask
) OVERRIDE
;
216 virtual void ResetWindowControls() OVERRIDE
{}
217 virtual void UpdateWindowIcon() OVERRIDE
{}
219 // Overridden from views::View:
220 virtual void OnPaint(gfx::Canvas
* canvas
) OVERRIDE
;
221 virtual void Layout() OVERRIDE
;
222 virtual void OnThemeChanged() OVERRIDE
;
224 // Overridden from views::ButtonListener:
225 virtual void ButtonPressed(views::Button
* sender
,
226 const ui::Event
& event
) OVERRIDE
;
229 // Returns the thickness of the entire nonclient left, right, and bottom
230 // borders, including both the window frame and any client edge.
231 int NonClientBorderThickness() const;
233 // Returns the height of the entire nonclient top border, including the window
234 // frame, any title area, and any connected client edge.
235 int NonClientTopBorderHeight() const;
237 // Returns the thickness of the nonclient portion of the 3D edge along the
238 // bottom of the titlebar.
239 int TitlebarBottomThickness() const;
241 // Returns what the size of the titlebar icon would be if there was one.
242 int IconSize() const;
244 // Returns what the titlebar icon's bounds would be if there was one.
245 gfx::Rect
IconBounds() const;
247 // Paints different parts of the window to the incoming canvas.
248 void PaintFrameBorder(gfx::Canvas
* canvas
);
249 void PaintTitleBar(gfx::Canvas
* canvas
);
250 void PaintClientEdge(gfx::Canvas
* canvas
);
252 // Layout various sub-components of this view.
253 void LayoutWindowControls();
254 void LayoutTitleBar();
256 // Returns the bounds of the client area for the specified view size.
257 gfx::Rect
CalculateClientAreaBounds(int width
, int height
) const;
259 SkColor
GetTitleColor() const {
260 return browser_is_off_the_record_
261 #if defined(OS_WIN) && !defined(USE_AURA)
262 || !ui::win::IsAeroGlassEnabled()
264 ? SK_ColorWHITE
: SK_ColorBLACK
;
267 // Loads the appropriate set of WindowResources for the frame view.
268 void InitWindowResources();
270 views::Widget
* container_
;
272 bool browser_is_off_the_record_
;
274 scoped_ptr
<views::WindowResources
> resources_
;
276 gfx::Rect title_bounds_
;
278 views::ImageButton
* close_button_
;
280 // The bounds of the ClientView.
281 gfx::Rect client_view_bounds_
;
283 // Background painter for the frame.
284 scoped_ptr
<views::FrameBackground
> frame_background_
;
286 static void InitClass();
288 // The font to be used to render the titlebar text.
289 static const gfx::Font
* title_font_
;
291 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameView
);
294 const gfx::Font
* ConstrainedWindowFrameView::title_font_
= NULL
;
297 // The frame border is only visible in restored mode and is hardcoded to 4 px on
298 // each side regardless of the system window border size.
299 const int kFrameBorderThickness
= 4;
300 // Various edges of the frame border have a 1 px shadow along their edges; in a
301 // few cases we shift elements based on this amount for visual appeal.
302 const int kFrameShadowThickness
= 1;
303 // In the window corners, the resize areas don't actually expand bigger, but the
304 // 16 px at the end of each edge triggers diagonal resizing.
305 const int kResizeAreaCornerSize
= 16;
306 // The titlebar never shrinks too short to show the caption button plus some
308 const int kCaptionButtonHeightWithPadding
= 19;
309 // The titlebar has a 2 px 3D edge along the top and bottom.
310 const int kTitlebarTopAndBottomEdgeThickness
= 2;
311 // The icon would never shrink below 16 px on a side, if there was one.
312 const int kIconMinimumSize
= 16;
313 // The title text starts 2 px from the right edge of the left frame border.
314 const int kTitleLeftSpacing
= 2;
315 // There is a 5 px gap between the title text and the caption buttons.
316 const int kTitleCaptionSpacing
= 5;
318 const SkColor kContentsBorderShadow
= SkColorSetARGB(51, 0, 0, 0);
322 ConstrainedWindowFrameView::ConstrainedWindowFrameView(
323 views::Widget
* container
, bool browser_is_off_the_record
)
324 : NonClientFrameView(),
325 container_(container
),
326 browser_is_off_the_record_(browser_is_off_the_record
),
327 close_button_(new views::ImageButton(this)),
328 frame_background_(new views::FrameBackground()) {
330 InitWindowResources();
332 // Constrained windows always use the custom frame - they just have a
333 // different set of images.
334 container
->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM
);
336 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
337 close_button_
->SetImage(views::CustomButton::STATE_NORMAL
,
338 rb
.GetImageSkiaNamed(IDR_CLOSE_SA
));
339 close_button_
->SetImage(views::CustomButton::STATE_HOVERED
,
340 rb
.GetImageSkiaNamed(IDR_CLOSE_SA_H
));
341 close_button_
->SetImage(views::CustomButton::STATE_PRESSED
,
342 rb
.GetImageSkiaNamed(IDR_CLOSE_SA_P
));
343 close_button_
->SetImageAlignment(views::ImageButton::ALIGN_CENTER
,
344 views::ImageButton::ALIGN_MIDDLE
);
345 AddChildView(close_button_
);
348 ConstrainedWindowFrameView::~ConstrainedWindowFrameView() {
351 void ConstrainedWindowFrameView::UpdateWindowTitle() {
352 SchedulePaintInRect(title_bounds_
);
355 gfx::Rect
ConstrainedWindowFrameView::GetBoundsForClientView() const {
356 return client_view_bounds_
;
359 gfx::Rect
ConstrainedWindowFrameView::GetWindowBoundsForClientBounds(
360 const gfx::Rect
& client_bounds
) const {
361 int top_height
= NonClientTopBorderHeight();
362 int border_thickness
= NonClientBorderThickness();
363 return gfx::Rect(std::max(0, client_bounds
.x() - border_thickness
),
364 std::max(0, client_bounds
.y() - top_height
),
365 client_bounds
.width() + (2 * border_thickness
),
366 client_bounds
.height() + top_height
+ border_thickness
);
369 int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point
& point
) {
370 if (!bounds().Contains(point
))
373 int frame_component
=
374 container_
->client_view()->NonClientHitTest(point
);
376 // See if we're in the sysmenu region. (We check the ClientView first to be
377 // consistent with OpaqueBrowserFrameView; it's not really necessary here.)
378 gfx::Rect
sysmenu_rect(IconBounds());
379 sysmenu_rect
.set_x(GetMirroredXForRect(sysmenu_rect
));
380 if (sysmenu_rect
.Contains(point
))
381 return (frame_component
== HTCLIENT
) ? HTCLIENT
: HTSYSMENU
;
383 if (frame_component
!= HTNOWHERE
)
384 return frame_component
;
386 // Then see if the point is within any of the window controls.
387 if (close_button_
->GetMirroredBounds().Contains(point
))
390 int window_component
= GetHTComponentForFrame(point
, kFrameBorderThickness
,
391 NonClientBorderThickness(), kResizeAreaCornerSize
, kResizeAreaCornerSize
,
392 container_
->widget_delegate()->CanResize());
393 // Fall back to the caption if no other component matches.
394 return (window_component
== HTNOWHERE
) ? HTCAPTION
: window_component
;
397 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size
& size
,
398 gfx::Path
* window_mask
) {
400 views::GetDefaultWindowMask(size
, window_mask
);
403 void ConstrainedWindowFrameView::OnPaint(gfx::Canvas
* canvas
) {
404 PaintFrameBorder(canvas
);
405 PaintTitleBar(canvas
);
406 PaintClientEdge(canvas
);
409 void ConstrainedWindowFrameView::Layout() {
410 LayoutWindowControls();
412 client_view_bounds_
= CalculateClientAreaBounds(width(), height());
415 void ConstrainedWindowFrameView::OnThemeChanged() {
416 InitWindowResources();
419 void ConstrainedWindowFrameView::ButtonPressed(
420 views::Button
* sender
, const ui::Event
& event
) {
421 if (sender
== close_button_
)
425 int ConstrainedWindowFrameView::NonClientBorderThickness() const {
426 return kFrameBorderThickness
+ kClientEdgeThickness
;
429 int ConstrainedWindowFrameView::NonClientTopBorderHeight() const {
430 return std::max(kFrameBorderThickness
+ IconSize(),
431 kFrameShadowThickness
+ kCaptionButtonHeightWithPadding
) +
432 TitlebarBottomThickness();
435 int ConstrainedWindowFrameView::TitlebarBottomThickness() const {
436 return kTitlebarTopAndBottomEdgeThickness
+ kClientEdgeThickness
;
439 int ConstrainedWindowFrameView::IconSize() const {
441 // This metric scales up if either the titlebar height or the titlebar font
442 // size are increased.
443 return GetSystemMetrics(SM_CYSMICON
);
445 return std::max(title_font_
->GetHeight(), kIconMinimumSize
);
449 gfx::Rect
ConstrainedWindowFrameView::IconBounds() const {
450 int size
= IconSize();
451 // Our frame border has a different "3D look" than Windows'. Theirs has a
452 // more complex gradient on the top that they push their icon/title below;
453 // then the maximized window cuts this off and the icon/title are centered
454 // in the remaining space. Because the apparent shape of our border is
455 // simpler, using the same positioning makes things look slightly uncentered
456 // with restored windows, so instead of calculating the remaining space from
457 // below the frame border, we calculate from below the 3D edge.
458 int unavailable_px_at_top
= kTitlebarTopAndBottomEdgeThickness
;
459 // When the icon is shorter than the minimum space we reserve for the caption
460 // button, we vertically center it. We want to bias rounding to put extra
461 // space above the icon, since the 3D edge + client edge below looks (to the
462 // eye) more like additional space than does the 3D edge above; hence the +1.
463 int y
= unavailable_px_at_top
+ (NonClientTopBorderHeight() -
464 unavailable_px_at_top
- size
- TitlebarBottomThickness() + 1) / 2;
465 return gfx::Rect(kFrameBorderThickness
+ kTitleLeftSpacing
, y
, size
, size
);
468 void ConstrainedWindowFrameView::PaintFrameBorder(gfx::Canvas
* canvas
) {
469 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
470 frame_background_
->set_frame_color(ThemeProperties::GetDefaultColor(
471 ThemeProperties::COLOR_FRAME
));
472 chrome::HostDesktopType desktop_type
=
473 chrome::GetHostDesktopTypeForNativeView(GetWidget()->GetNativeView());
474 gfx::ImageSkia
* theme_frame
= rb
.GetImageSkiaNamed(
475 chrome::MapThemeImage(desktop_type
, IDR_THEME_FRAME
));
476 frame_background_
->set_theme_image(theme_frame
);
477 frame_background_
->set_theme_overlay_image(NULL
);
478 frame_background_
->set_top_area_height(theme_frame
->height());
480 frame_background_
->SetCornerImages(
481 resources_
->GetPartImage(FRAME_TOP_LEFT_CORNER
),
482 resources_
->GetPartImage(FRAME_TOP_RIGHT_CORNER
),
483 resources_
->GetPartImage(FRAME_BOTTOM_LEFT_CORNER
),
484 resources_
->GetPartImage(FRAME_BOTTOM_RIGHT_CORNER
));
485 frame_background_
->SetSideImages(
486 resources_
->GetPartImage(FRAME_LEFT_EDGE
),
487 resources_
->GetPartImage(FRAME_TOP_EDGE
),
488 resources_
->GetPartImage(FRAME_RIGHT_EDGE
),
489 resources_
->GetPartImage(FRAME_BOTTOM_EDGE
));
490 frame_background_
->PaintRestored(canvas
, this);
493 void ConstrainedWindowFrameView::PaintTitleBar(gfx::Canvas
* canvas
) {
494 canvas
->DrawStringInt(
495 container_
->widget_delegate()->GetWindowTitle(),
496 *title_font_
, GetTitleColor(), GetMirroredXForRect(title_bounds_
),
497 title_bounds_
.y(), title_bounds_
.width(), title_bounds_
.height());
500 void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas
* canvas
) {
501 gfx::Rect
client_edge_bounds(CalculateClientAreaBounds(width(), height()));
502 client_edge_bounds
.Inset(-kClientEdgeThickness
, -kClientEdgeThickness
);
503 gfx::Rect
frame_shadow_bounds(client_edge_bounds
);
504 frame_shadow_bounds
.Inset(-kFrameShadowThickness
, -kFrameShadowThickness
);
506 canvas
->FillRect(frame_shadow_bounds
, kContentsBorderShadow
);
507 canvas
->FillRect(client_edge_bounds
, views::kClientEdgeColor
);
510 void ConstrainedWindowFrameView::LayoutWindowControls() {
511 gfx::Size close_button_size
= close_button_
->GetPreferredSize();
512 close_button_
->SetBounds(
513 width() - kFrameBorderThickness
- close_button_size
.width(),
514 kFrameShadowThickness
, close_button_size
.width(),
515 close_button_size
.height());
518 void ConstrainedWindowFrameView::LayoutTitleBar() {
519 // The window title is based on the calculated icon position, even though'
520 // there is no icon in constrained windows.
521 gfx::Rect
icon_bounds(IconBounds());
522 int title_x
= icon_bounds
.x();
523 int title_height
= title_font_
->GetHeight();
524 // We bias the title position so that when the difference between the icon and
525 // title heights is odd, the extra pixel of the title is above the vertical
526 // midline rather than below. This compensates for how the icon is already
527 // biased downwards (see IconBounds()) and helps prevent descenders on the
528 // title from overlapping the 3D edge at the bottom of the titlebar.
529 title_bounds_
.SetRect(title_x
,
530 icon_bounds
.y() + ((icon_bounds
.height() - title_height
- 1) / 2),
531 std::max(0, close_button_
->x() - kTitleCaptionSpacing
- title_x
),
535 gfx::Rect
ConstrainedWindowFrameView::CalculateClientAreaBounds(
538 int top_height
= NonClientTopBorderHeight();
539 int border_thickness
= NonClientBorderThickness();
540 return gfx::Rect(border_thickness
, top_height
,
541 std::max(0, width
- (2 * border_thickness
)),
542 std::max(0, height
- top_height
- border_thickness
));
545 void ConstrainedWindowFrameView::InitWindowResources() {
546 #if defined(OS_WIN) && !defined(USE_AURA)
547 resources_
.reset(ui::win::IsAeroGlassEnabled() ?
548 static_cast<views::WindowResources
*>(new VistaWindowResources
) :
549 new XPWindowResources
);
551 // TODO(oshima): Use aura frame decoration.
552 resources_
.reset(new XPWindowResources
);
557 void ConstrainedWindowFrameView::InitClass() {
558 static bool initialized
= false;
560 #if defined(OS_WIN) && !defined(USE_AURA)
561 title_font_
= new gfx::Font(views::NativeWidgetWin::GetWindowTitleFont());
563 ui::ResourceBundle
& rb
= ui::ResourceBundle::GetSharedInstance();
564 title_font_
= &rb
.GetFont(ui::ResourceBundle::MediumFont
);
570 void UpdateWebContentsModalDialogPosition(
571 views::Widget
* widget
,
572 web_modal::WebContentsModalDialogHost
* dialog_host
) {
573 gfx::Size size
= widget
->GetWindowBoundsInScreen().size();
574 gfx::Point position
= dialog_host
->GetDialogPosition(size
);
575 views::Border
* border
=
576 widget
->non_client_view()->frame_view()->border();
577 // Border may be null during widget initialization.
579 // Align the first row of pixels inside the border. This is the apparent
580 // top of the dialog.
581 position
.set_y(position
.y() - border
->GetInsets().top());
584 if (widget
->is_top_level()) {
586 views::Widget::GetWidgetForNativeView(dialog_host
->GetHostView())->
587 GetClientAreaBoundsInScreen().OffsetFromOrigin();
590 widget
->SetBounds(gfx::Rect(position
, size
));
593 views::Widget
* CreateBrowserModalDialogViews(views::DialogDelegate
* dialog
,
594 gfx::NativeWindow parent
) {
595 views::Widget
* widget
=
596 views::DialogDelegate::CreateDialogWidget(dialog
, NULL
, parent
);
597 if (!dialog
->UseNewStyleForThisDialog())
600 // Get the browser dialog management and hosting components from |parent|.
601 Browser
* browser
= chrome::FindBrowserWithWindow(parent
);
603 ChromeWebModalDialogManagerDelegate
* manager
= browser
;
604 WebContentsModalDialogHost
* host
= manager
->GetWebContentsModalDialogHost();
605 DCHECK_EQ(parent
, host
->GetHostView());
606 WebContentsModalDialogHostObserver
* dialog_host_observer
=
607 new WebContentsModalDialogHostObserverViews(
608 host
, widget
, kWebContentsModalDialogHostObserverViewsKey
);
609 dialog_host_observer
->OnPositionRequiresUpdate();
614 views::NonClientFrameView
* CreateConstrainedStyleNonClientFrameView(
615 views::Widget
* widget
,
616 content::BrowserContext
* browser_context
) {
617 if (views::DialogDelegate::UseNewStyle()) {
618 #if defined(USE_AURA)
619 const bool force_opaque_border
= false;
621 const bool force_opaque_border
= true;
623 return views::DialogDelegate::CreateNewStyleFrameView(widget
,
624 force_opaque_border
);
627 ash::CustomFrameViewAsh
* frame
= new ash::CustomFrameViewAsh
;
629 // Always use "active" look.
630 frame
->SetInactiveRenderingDisabled(true);
633 return new ConstrainedWindowFrameView(widget
,
634 browser_context
->IsOffTheRecord());