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::ModalDialogHost;
43 using web_modal::ModalDialogHostObserver;
46 // The name of a key to store on the window handle to associate
47 // BrowserModalDialogHostObserverViews with the Widget.
48 const char* const kBrowserModalDialogHostObserverViewsKey =
49 "__BROWSER_MODAL_DIALOG_HOST_OBSERVER_VIEWS__";
51 // Applies positioning changes from the ModalDialogHost to the Widget.
52 class BrowserModalDialogHostObserverViews
53 : public views::WidgetObserver,
54 public ModalDialogHostObserver {
56 BrowserModalDialogHostObserverViews(
57 ModalDialogHost* host,
58 views::Widget* target_widget,
59 const char *const native_window_property)
61 target_widget_(target_widget),
62 native_window_property_(native_window_property) {
64 DCHECK(target_widget_);
65 host_->AddObserver(this);
66 target_widget_->AddObserver(this);
69 virtual ~BrowserModalDialogHostObserverViews() {
71 host_->RemoveObserver(this);
72 target_widget_->RemoveObserver(this);
73 target_widget_->SetNativeWindowProperty(native_window_property_,
77 // WidgetObserver overrides
78 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE {
82 // WebContentsModalDialogHostObserver overrides
83 virtual void OnPositionRequiresUpdate() OVERRIDE {
84 UpdateBrowserModalDialogPosition(target_widget_, host_);
87 virtual void OnHostDestroying() OVERRIDE {
88 host_->RemoveObserver(this);
93 ModalDialogHost* host_;
94 views::Widget* target_widget_;
95 const char* const native_window_property_;
97 DISALLOW_COPY_AND_ASSIGN(BrowserModalDialogHostObserverViews);
100 void UpdateModalDialogPosition(
101 views::Widget* widget,
102 web_modal::ModalDialogHost* dialog_host,
103 const gfx::Size& size) {
104 // Do not forcibly update the dialog widget position if it is being dragged.
105 if (widget->HasCapture())
108 gfx::Point position = dialog_host->GetDialogPosition(size);
109 views::Border* border =
110 widget->non_client_view()->frame_view()->border();
111 // Border may be null during widget initialization.
113 // Align the first row of pixels inside the border. This is the apparent
114 // top of the dialog.
115 position.set_y(position.y() - border->GetInsets().top());
118 if (widget->is_top_level()) {
120 views::Widget::GetWidgetForNativeView(dialog_host->GetHostView())->
121 GetClientAreaBoundsInScreen().OffsetFromOrigin();
124 widget->SetBounds(gfx::Rect(position, size));
129 // An enumeration of image resources used by this window.
131 FRAME_PART_IMAGE_FIRST = 0, // Must be first.
133 // Window Frame Border.
135 FRAME_BOTTOM_LEFT_CORNER,
136 FRAME_BOTTOM_RIGHT_CORNER,
140 FRAME_TOP_LEFT_CORNER,
141 FRAME_TOP_RIGHT_CORNER,
143 FRAME_PART_IMAGE_COUNT // Must be last.
146 static const int kXPFramePartIDs[] = {
148 IDR_WINDOW_BOTTOM_CENTER, IDR_WINDOW_BOTTOM_LEFT_CORNER,
149 IDR_WINDOW_BOTTOM_RIGHT_CORNER, IDR_WINDOW_LEFT_SIDE,
150 IDR_WINDOW_RIGHT_SIDE, IDR_WINDOW_TOP_CENTER,
151 IDR_WINDOW_TOP_LEFT_CORNER, IDR_WINDOW_TOP_RIGHT_CORNER,
153 static const int kVistaFramePartIDs[] = {
155 IDR_CONSTRAINED_BOTTOM_CENTER_V, IDR_CONSTRAINED_BOTTOM_LEFT_CORNER_V,
156 IDR_CONSTRAINED_BOTTOM_RIGHT_CORNER_V, IDR_CONSTRAINED_LEFT_SIDE_V,
157 IDR_CONSTRAINED_RIGHT_SIDE_V, IDR_CONSTRAINED_TOP_CENTER_V,
158 IDR_CONSTRAINED_TOP_LEFT_CORNER_V, IDR_CONSTRAINED_TOP_RIGHT_CORNER_V,
161 class XPWindowResources : public views::WindowResources {
163 XPWindowResources() {
166 virtual ~XPWindowResources() {}
168 virtual gfx::ImageSkia* GetPartImage(
169 views::FramePartImage part_id) const OVERRIDE {
170 return images_[part_id];
174 static void InitClass() {
175 static bool initialized = false;
177 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
178 for (int i = 0; i < FRAME_PART_IMAGE_COUNT; ++i) {
179 int id = kXPFramePartIDs[i];
181 images_[i] = rb.GetImageSkiaNamed(id);
187 static gfx::ImageSkia* images_[FRAME_PART_IMAGE_COUNT];
189 DISALLOW_COPY_AND_ASSIGN(XPWindowResources);
192 class VistaWindowResources : public views::WindowResources {
194 VistaWindowResources() {
197 virtual ~VistaWindowResources() {}
199 virtual gfx::ImageSkia* GetPartImage(
200 views::FramePartImage part_id) const OVERRIDE {
201 return images_[part_id];
205 static void InitClass() {
206 static bool initialized = false;
208 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
209 for (int i = 0; i < FRAME_PART_IMAGE_COUNT; ++i) {
210 int id = kVistaFramePartIDs[i];
212 images_[i] = rb.GetImageSkiaNamed(id);
218 static gfx::ImageSkia* images_[FRAME_PART_IMAGE_COUNT];
220 DISALLOW_COPY_AND_ASSIGN(VistaWindowResources);
223 gfx::ImageSkia* XPWindowResources::images_[];
224 gfx::ImageSkia* VistaWindowResources::images_[];
226 class ConstrainedWindowFrameView : public views::NonClientFrameView,
227 public views::ButtonListener {
229 ConstrainedWindowFrameView(views::Widget* container,
230 bool browser_is_off_the_record);
231 virtual ~ConstrainedWindowFrameView();
233 virtual void UpdateWindowTitle() OVERRIDE;
235 // Overridden from views::NonClientFrameView:
236 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
237 virtual gfx::Rect GetWindowBoundsForClientBounds(
238 const gfx::Rect& client_bounds) const OVERRIDE;
239 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
240 virtual void GetWindowMask(const gfx::Size& size,
241 gfx::Path* window_mask) OVERRIDE;
242 virtual void ResetWindowControls() OVERRIDE {}
243 virtual void UpdateWindowIcon() OVERRIDE {}
245 // Overridden from views::View:
246 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
247 virtual void Layout() OVERRIDE;
248 virtual void OnThemeChanged() OVERRIDE;
250 // Overridden from views::ButtonListener:
251 virtual void ButtonPressed(views::Button* sender,
252 const ui::Event& event) OVERRIDE;
255 // Returns the thickness of the entire nonclient left, right, and bottom
256 // borders, including both the window frame and any client edge.
257 int NonClientBorderThickness() const;
259 // Returns the height of the entire nonclient top border, including the window
260 // frame, any title area, and any connected client edge.
261 int NonClientTopBorderHeight() const;
263 // Returns the thickness of the nonclient portion of the 3D edge along the
264 // bottom of the titlebar.
265 int TitlebarBottomThickness() const;
267 // Returns what the size of the titlebar icon would be if there was one.
268 int IconSize() const;
270 // Returns what the titlebar icon's bounds would be if there was one.
271 gfx::Rect IconBounds() const;
273 // Paints different parts of the window to the incoming canvas.
274 void PaintFrameBorder(gfx::Canvas* canvas);
275 void PaintTitleBar(gfx::Canvas* canvas);
276 void PaintClientEdge(gfx::Canvas* canvas);
278 // Layout various sub-components of this view.
279 void LayoutWindowControls();
280 void LayoutTitleBar();
282 // Returns the bounds of the client area for the specified view size.
283 gfx::Rect CalculateClientAreaBounds(int width, int height) const;
285 SkColor GetTitleColor() const {
286 return browser_is_off_the_record_
287 #if defined(OS_WIN) && !defined(USE_AURA)
288 || !ui::win::IsAeroGlassEnabled()
290 ? SK_ColorWHITE : SK_ColorBLACK;
293 // Loads the appropriate set of WindowResources for the frame view.
294 void InitWindowResources();
296 views::Widget* container_;
298 bool browser_is_off_the_record_;
300 scoped_ptr<views::WindowResources> resources_;
302 gfx::Rect title_bounds_;
304 views::ImageButton* close_button_;
306 // The bounds of the ClientView.
307 gfx::Rect client_view_bounds_;
309 // Background painter for the frame.
310 scoped_ptr<views::FrameBackground> frame_background_;
312 static void InitClass();
314 // The font to be used to render the titlebar text.
315 static const gfx::Font* title_font_;
317 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameView);
320 const gfx::Font* ConstrainedWindowFrameView::title_font_ = NULL;
323 // The frame border is only visible in restored mode and is hardcoded to 4 px on
324 // each side regardless of the system window border size.
325 const int kFrameBorderThickness = 4;
326 // In the window corners, the resize areas don't actually expand bigger, but the
327 // 16 px at the end of each edge triggers diagonal resizing.
328 const int kResizeAreaCornerSize = 16;
329 // The titlebar never shrinks too short to show the caption button plus some
331 const int kCaptionButtonHeightWithPadding = 19;
332 // The titlebar has a 2 px 3D edge along the top and bottom.
333 const int kTitlebarTopAndBottomEdgeThickness = 2;
334 // The icon would never shrink below 16 px on a side, if there was one.
335 const int kIconMinimumSize = 16;
336 // The title text starts 2 px from the right edge of the left frame border.
337 const int kTitleLeftSpacing = 2;
338 // There is a 5 px gap between the title text and the caption buttons.
339 const int kTitleCaptionSpacing = 5;
341 const SkColor kContentsBorderShadow = SkColorSetARGB(51, 0, 0, 0);
345 ConstrainedWindowFrameView::ConstrainedWindowFrameView(
346 views::Widget* container, bool browser_is_off_the_record)
347 : NonClientFrameView(),
348 container_(container),
349 browser_is_off_the_record_(browser_is_off_the_record),
350 close_button_(new views::ImageButton(this)),
351 frame_background_(new views::FrameBackground()) {
353 InitWindowResources();
355 // Constrained windows always use the custom frame - they just have a
356 // different set of images.
357 container->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
359 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
360 close_button_->SetImage(views::CustomButton::STATE_NORMAL,
361 rb.GetImageSkiaNamed(IDR_CLOSE_SA));
362 close_button_->SetImage(views::CustomButton::STATE_HOVERED,
363 rb.GetImageSkiaNamed(IDR_CLOSE_SA_H));
364 close_button_->SetImage(views::CustomButton::STATE_PRESSED,
365 rb.GetImageSkiaNamed(IDR_CLOSE_SA_P));
366 close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
367 views::ImageButton::ALIGN_MIDDLE);
368 AddChildView(close_button_);
371 ConstrainedWindowFrameView::~ConstrainedWindowFrameView() {
374 void ConstrainedWindowFrameView::UpdateWindowTitle() {
375 SchedulePaintInRect(title_bounds_);
378 gfx::Rect ConstrainedWindowFrameView::GetBoundsForClientView() const {
379 return client_view_bounds_;
382 gfx::Rect ConstrainedWindowFrameView::GetWindowBoundsForClientBounds(
383 const gfx::Rect& client_bounds) const {
384 int top_height = NonClientTopBorderHeight();
385 int border_thickness = NonClientBorderThickness();
386 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness),
387 std::max(0, client_bounds.y() - top_height),
388 client_bounds.width() + (2 * border_thickness),
389 client_bounds.height() + top_height + border_thickness);
392 int ConstrainedWindowFrameView::NonClientHitTest(const gfx::Point& point) {
393 if (!bounds().Contains(point))
396 int frame_component =
397 container_->client_view()->NonClientHitTest(point);
399 // See if we're in the sysmenu region. (We check the ClientView first to be
400 // consistent with OpaqueBrowserFrameView; it's not really necessary here.)
401 gfx::Rect sysmenu_rect(IconBounds());
402 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect));
403 if (sysmenu_rect.Contains(point))
404 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU;
406 if (frame_component != HTNOWHERE)
407 return frame_component;
409 // Then see if the point is within any of the window controls.
410 if (close_button_->GetMirroredBounds().Contains(point))
413 int window_component = GetHTComponentForFrame(point, kFrameBorderThickness,
414 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize,
415 container_->widget_delegate()->CanResize());
416 // Fall back to the caption if no other component matches.
417 return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
420 void ConstrainedWindowFrameView::GetWindowMask(const gfx::Size& size,
421 gfx::Path* window_mask) {
423 views::GetDefaultWindowMask(size, window_mask);
426 void ConstrainedWindowFrameView::OnPaint(gfx::Canvas* canvas) {
427 PaintFrameBorder(canvas);
428 PaintTitleBar(canvas);
429 PaintClientEdge(canvas);
432 void ConstrainedWindowFrameView::Layout() {
433 LayoutWindowControls();
435 client_view_bounds_ = CalculateClientAreaBounds(width(), height());
438 void ConstrainedWindowFrameView::OnThemeChanged() {
439 InitWindowResources();
442 void ConstrainedWindowFrameView::ButtonPressed(
443 views::Button* sender, const ui::Event& event) {
444 if (sender == close_button_)
448 int ConstrainedWindowFrameView::NonClientBorderThickness() const {
449 return kFrameBorderThickness + kClientEdgeThickness;
452 int ConstrainedWindowFrameView::NonClientTopBorderHeight() const {
453 return std::max(kFrameBorderThickness + IconSize(),
454 kFrameShadowThickness + kCaptionButtonHeightWithPadding) +
455 TitlebarBottomThickness();
458 int ConstrainedWindowFrameView::TitlebarBottomThickness() const {
459 return kTitlebarTopAndBottomEdgeThickness + kClientEdgeThickness;
462 int ConstrainedWindowFrameView::IconSize() const {
464 // This metric scales up if either the titlebar height or the titlebar font
465 // size are increased.
466 return GetSystemMetrics(SM_CYSMICON);
468 return std::max(title_font_->GetHeight(), kIconMinimumSize);
472 gfx::Rect ConstrainedWindowFrameView::IconBounds() const {
473 int size = IconSize();
474 // Our frame border has a different "3D look" than Windows'. Theirs has a
475 // more complex gradient on the top that they push their icon/title below;
476 // then the maximized window cuts this off and the icon/title are centered
477 // in the remaining space. Because the apparent shape of our border is
478 // simpler, using the same positioning makes things look slightly uncentered
479 // with restored windows, so instead of calculating the remaining space from
480 // below the frame border, we calculate from below the 3D edge.
481 int unavailable_px_at_top = kTitlebarTopAndBottomEdgeThickness;
482 // When the icon is shorter than the minimum space we reserve for the caption
483 // button, we vertically center it. We want to bias rounding to put extra
484 // space above the icon, since the 3D edge + client edge below looks (to the
485 // eye) more like additional space than does the 3D edge above; hence the +1.
486 int y = unavailable_px_at_top + (NonClientTopBorderHeight() -
487 unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2;
488 return gfx::Rect(kFrameBorderThickness + kTitleLeftSpacing, y, size, size);
491 void ConstrainedWindowFrameView::PaintFrameBorder(gfx::Canvas* canvas) {
492 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
493 frame_background_->set_frame_color(ThemeProperties::GetDefaultColor(
494 ThemeProperties::COLOR_FRAME));
495 chrome::HostDesktopType desktop_type =
496 chrome::GetHostDesktopTypeForNativeView(GetWidget()->GetNativeView());
497 gfx::ImageSkia* theme_frame = rb.GetImageSkiaNamed(
498 chrome::MapThemeImage(desktop_type, IDR_THEME_FRAME));
499 frame_background_->set_theme_image(theme_frame);
500 frame_background_->set_theme_overlay_image(NULL);
501 frame_background_->set_top_area_height(theme_frame->height());
503 frame_background_->SetCornerImages(
504 resources_->GetPartImage(FRAME_TOP_LEFT_CORNER),
505 resources_->GetPartImage(FRAME_TOP_RIGHT_CORNER),
506 resources_->GetPartImage(FRAME_BOTTOM_LEFT_CORNER),
507 resources_->GetPartImage(FRAME_BOTTOM_RIGHT_CORNER));
508 frame_background_->SetSideImages(
509 resources_->GetPartImage(FRAME_LEFT_EDGE),
510 resources_->GetPartImage(FRAME_TOP_EDGE),
511 resources_->GetPartImage(FRAME_RIGHT_EDGE),
512 resources_->GetPartImage(FRAME_BOTTOM_EDGE));
513 frame_background_->PaintRestored(canvas, this);
516 void ConstrainedWindowFrameView::PaintTitleBar(gfx::Canvas* canvas) {
517 canvas->DrawStringInt(
518 container_->widget_delegate()->GetWindowTitle(),
519 *title_font_, GetTitleColor(), GetMirroredXForRect(title_bounds_),
520 title_bounds_.y(), title_bounds_.width(), title_bounds_.height());
523 void ConstrainedWindowFrameView::PaintClientEdge(gfx::Canvas* canvas) {
524 gfx::Rect client_edge_bounds(CalculateClientAreaBounds(width(), height()));
525 client_edge_bounds.Inset(-kClientEdgeThickness, -kClientEdgeThickness);
526 gfx::Rect frame_shadow_bounds(client_edge_bounds);
527 frame_shadow_bounds.Inset(-kFrameShadowThickness, -kFrameShadowThickness);
529 canvas->FillRect(frame_shadow_bounds, kContentsBorderShadow);
530 canvas->FillRect(client_edge_bounds, views::kClientEdgeColor);
533 void ConstrainedWindowFrameView::LayoutWindowControls() {
534 gfx::Size close_button_size = close_button_->GetPreferredSize();
535 close_button_->SetBounds(
536 width() - kFrameBorderThickness - close_button_size.width(),
537 kFrameShadowThickness, close_button_size.width(),
538 close_button_size.height());
541 void ConstrainedWindowFrameView::LayoutTitleBar() {
542 // The window title is based on the calculated icon position, even though'
543 // there is no icon in constrained windows.
544 gfx::Rect icon_bounds(IconBounds());
545 int title_x = icon_bounds.x();
546 int title_height = title_font_->GetHeight();
547 // We bias the title position so that when the difference between the icon and
548 // title heights is odd, the extra pixel of the title is above the vertical
549 // midline rather than below. This compensates for how the icon is already
550 // biased downwards (see IconBounds()) and helps prevent descenders on the
551 // title from overlapping the 3D edge at the bottom of the titlebar.
552 title_bounds_.SetRect(title_x,
553 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2),
554 std::max(0, close_button_->x() - kTitleCaptionSpacing - title_x),
558 gfx::Rect ConstrainedWindowFrameView::CalculateClientAreaBounds(
561 int top_height = NonClientTopBorderHeight();
562 int border_thickness = NonClientBorderThickness();
563 return gfx::Rect(border_thickness, top_height,
564 std::max(0, width - (2 * border_thickness)),
565 std::max(0, height - top_height - border_thickness));
568 void ConstrainedWindowFrameView::InitWindowResources() {
569 #if defined(OS_WIN) && !defined(USE_AURA)
570 resources_.reset(ui::win::IsAeroGlassEnabled() ?
571 static_cast<views::WindowResources*>(new VistaWindowResources) :
572 new XPWindowResources);
574 // TODO(oshima): Use aura frame decoration.
575 resources_.reset(new XPWindowResources);
580 void ConstrainedWindowFrameView::InitClass() {
581 static bool initialized = false;
583 #if defined(OS_WIN) && !defined(USE_AURA)
584 title_font_ = new gfx::Font(views::NativeWidgetWin::GetWindowTitleFont());
586 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
587 title_font_ = &rb.GetFont(ui::ResourceBundle::MediumFont);
593 void UpdateWebContentsModalDialogPosition(
594 views::Widget* widget,
595 web_modal::WebContentsModalDialogHost* dialog_host) {
596 gfx::Size size = widget->GetRootView()->GetPreferredSize();
597 gfx::Size max_size = dialog_host->GetMaximumDialogSize();
598 // Enlarge the max size by the top border, as the dialog will be shifted
599 // outside the area specified by the dialog host by this amount later.
600 views::Border* border =
601 widget->non_client_view()->frame_view()->border();
602 // Border may be null during widget initialization.
604 max_size.Enlarge(0, border->GetInsets().top());
605 size.SetToMin(max_size);
606 UpdateModalDialogPosition(widget, dialog_host, size);
609 void UpdateBrowserModalDialogPosition(
610 views::Widget* widget,
611 web_modal::ModalDialogHost* dialog_host) {
612 UpdateModalDialogPosition(widget,
614 widget->GetRootView()->GetPreferredSize());
617 views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
618 gfx::NativeWindow parent) {
619 views::Widget* widget =
620 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent);
621 if (!dialog->UseNewStyleForThisDialog())
624 // Get the browser dialog management and hosting components from |parent|.
625 Browser* browser = chrome::FindBrowserWithWindow(parent);
627 ChromeWebModalDialogManagerDelegate* manager = browser;
628 ModalDialogHost* host = manager->GetWebContentsModalDialogHost();
629 DCHECK_EQ(parent, host->GetHostView());
630 ModalDialogHostObserver* dialog_host_observer =
631 new BrowserModalDialogHostObserverViews(
632 host, widget, kBrowserModalDialogHostObserverViewsKey);
633 dialog_host_observer->OnPositionRequiresUpdate();
638 views::NonClientFrameView* CreateConstrainedStyleNonClientFrameView(
639 views::Widget* widget,
640 content::BrowserContext* browser_context) {
641 if (views::DialogDelegate::UseNewStyle()) {
642 #if defined(USE_AURA)
643 const bool force_opaque_border = false;
645 const bool force_opaque_border = true;
647 return views::DialogDelegate::CreateNewStyleFrameView(widget,
648 force_opaque_border);
651 ash::CustomFrameViewAsh* frame = new ash::CustomFrameViewAsh(widget);
652 // Always use "active" look.
653 frame->SetInactiveRenderingDisabled(true);
656 return new ConstrainedWindowFrameView(widget,
657 browser_context->IsOffTheRecord());