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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 14742002: Render opaque border with no shadow for web contents modal dialogs under Views/Win32 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS build failure Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/constrained_window_views.h" 5 #include "chrome/browser/ui/views/constrained_window_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 17 matching lines...) Expand all
28 #include "net/base/net_util.h" 28 #include "net/base/net_util.h"
29 #include "ui/aura/client/aura_constants.h" 29 #include "ui/aura/client/aura_constants.h"
30 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
31 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
32 #include "ui/base/ui_base_switches.h" 32 #include "ui/base/ui_base_switches.h"
33 #include "ui/gfx/canvas.h" 33 #include "ui/gfx/canvas.h"
34 #include "ui/gfx/font.h" 34 #include "ui/gfx/font.h"
35 #include "ui/gfx/path.h" 35 #include "ui/gfx/path.h"
36 #include "ui/gfx/rect.h" 36 #include "ui/gfx/rect.h"
37 #include "ui/gfx/screen.h" 37 #include "ui/gfx/screen.h"
38 #include "ui/views/border.h"
38 #include "ui/views/color_constants.h" 39 #include "ui/views/color_constants.h"
39 #include "ui/views/controls/button/image_button.h" 40 #include "ui/views/controls/button/image_button.h"
40 #include "ui/views/focus/focus_manager.h" 41 #include "ui/views/focus/focus_manager.h"
41 #include "ui/views/views_delegate.h" 42 #include "ui/views/views_delegate.h"
42 #include "ui/views/widget/widget.h" 43 #include "ui/views/widget/widget.h"
43 #include "ui/views/widget/widget_observer.h" 44 #include "ui/views/widget/widget_observer.h"
44 #include "ui/views/window/client_view.h" 45 #include "ui/views/window/client_view.h"
45 #include "ui/views/window/dialog_client_view.h" 46 #include "ui/views/window/dialog_client_view.h"
46 #include "ui/views/window/dialog_delegate.h" 47 #include "ui/views/window/dialog_delegate.h"
47 #include "ui/views/window/frame_background.h" 48 #include "ui/views/window/frame_background.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 // WidgetObserver overrides 109 // WidgetObserver overrides
109 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE { 110 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE {
110 delete this; 111 delete this;
111 } 112 }
112 113
113 // WebContentsModalDialogHostObserver overrides 114 // WebContentsModalDialogHostObserver overrides
114 virtual void OnPositionRequiresUpdate() OVERRIDE { 115 virtual void OnPositionRequiresUpdate() OVERRIDE {
115 gfx::Size size = target_widget_->GetWindowBoundsInScreen().size(); 116 gfx::Size size = target_widget_->GetWindowBoundsInScreen().size();
116 gfx::Point position = host_->GetDialogPosition(size); 117 gfx::Point position = host_->GetDialogPosition(size);
118 views::Border* border =
119 target_widget_->non_client_view()->frame_view()->border();
120 // Border may be null during widget initialization.
121 if (border) {
122 // Align the first row of pixels inside the border. This is the apparent
123 // top of the dialog.
124 gfx::Insets border_insets = border->GetInsets();
125 position -= gfx::Vector2d(border_insets.left(), border_insets.top());
126 }
117 target_widget_->SetBounds(gfx::Rect(position, size)); 127 target_widget_->SetBounds(gfx::Rect(position, size));
118 } 128 }
119 129
120 private: 130 private:
121 WebContentsModalDialogHost* host_; 131 WebContentsModalDialogHost* host_;
122 views::Widget* target_widget_; 132 views::Widget* target_widget_;
123 const char* const native_window_property_; 133 const char* const native_window_property_;
124 134
125 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostObserverViews); 135 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostObserverViews);
126 }; 136 };
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 dialog->SetNativeWindowProperty(kWebContentsModalDialogHostObserverViewsKey, 664 dialog->SetNativeWindowProperty(kWebContentsModalDialogHostObserverViewsKey,
655 dialog_host_observer); 665 dialog_host_observer);
656 } 666 }
657 667
658 return dialog; 668 return dialog;
659 } 669 }
660 670
661 views::NonClientFrameView* CreateConstrainedStyleNonClientFrameView( 671 views::NonClientFrameView* CreateConstrainedStyleNonClientFrameView(
662 views::Widget* widget, 672 views::Widget* widget,
663 content::BrowserContext* browser_context) { 673 content::BrowserContext* browser_context) {
664 if (views::DialogDelegate::UseNewStyle()) 674 if (views::DialogDelegate::UseNewStyle()) {
665 return views::DialogDelegate::CreateNewStyleFrameView(widget); 675 #if defined(USE_AURA)
676 const bool force_opaque_border = false;
677 #else
678 const bool force_opaque_border = true;
679 #endif
680 return views::DialogDelegate::CreateNewStyleFrameView(widget,
681 force_opaque_border);
682 }
666 #if defined(USE_ASH) 683 #if defined(USE_ASH)
667 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh; 684 ConstrainedWindowFrameViewAsh* frame = new ConstrainedWindowFrameViewAsh;
668 frame->Init(widget); 685 frame->Init(widget);
669 return frame; 686 return frame;
670 #endif 687 #endif
671 return new ConstrainedWindowFrameView(widget, 688 return new ConstrainedWindowFrameView(widget,
672 browser_context->IsOffTheRecord()); 689 browser_context->IsOffTheRecord());
673 } 690 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698