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

Side by Side Diff: ui/views/window/dialog_delegate.cc

Issue 12184004: Replace DialogFrameView with an enhanced BubbleFrameView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment. 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
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | ui/views/window/dialog_frame_view.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 "ui/views/window/dialog_delegate.h" 5 #include "ui/views/window/dialog_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/base/ui_base_switches.h" 9 #include "ui/base/ui_base_switches.h"
10 #include "ui/views/bubble/bubble_border.h"
11 #include "ui/views/bubble/bubble_frame_view.h"
10 #include "ui/views/controls/button/text_button.h" 12 #include "ui/views/controls/button/text_button.h"
11 #include "ui/views/widget/widget.h" 13 #include "ui/views/widget/widget.h"
12 #include "ui/views/widget/widget_observer.h" 14 #include "ui/views/widget/widget_observer.h"
13 #include "ui/views/window/dialog_client_view.h" 15 #include "ui/views/window/dialog_client_view.h"
14 #include "ui/views/window/dialog_frame_view.h"
15 16
16 namespace views { 17 namespace views {
17 18
18 namespace { 19 namespace {
19 20
20 // Create a widget to host the dialog. 21 // Create a widget to host the dialog.
21 Widget* CreateDialogWidgetImpl(DialogDelegateView* dialog_delegate_view, 22 Widget* CreateDialogWidgetImpl(DialogDelegateView* dialog_delegate_view,
22 gfx::NativeWindow context, 23 gfx::NativeWindow context,
23 gfx::NativeWindow parent) { 24 gfx::NativeWindow parent) {
24 views::Widget* widget = new views::Widget; 25 views::Widget* widget = new views::Widget;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 DialogDelegate* DialogDelegate::AsDialogDelegate() { 127 DialogDelegate* DialogDelegate::AsDialogDelegate() {
127 return this; 128 return this;
128 } 129 }
129 130
130 ClientView* DialogDelegate::CreateClientView(Widget* widget) { 131 ClientView* DialogDelegate::CreateClientView(Widget* widget) {
131 return new DialogClientView(widget, GetContentsView()); 132 return new DialogClientView(widget, GetContentsView());
132 } 133 }
133 134
134 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { 135 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) {
135 return UseNewStyle() ? new DialogFrameView(GetWindowTitle()) : 136 return UseNewStyle() ? CreateNewStyleFrameView(widget) :
136 WidgetDelegate::CreateNonClientFrameView(widget); 137 WidgetDelegate::CreateNonClientFrameView(widget);
138 }
139
140 // static
141 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(Widget* widget) {
142 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets(20, 20, 20, 20));
143 const SkColor color = widget->GetNativeTheme()->GetSystemColor(
144 ui::NativeTheme::kColorId_DialogBackground);
145 frame->SetBubbleBorder(
146 new BubbleBorder(BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, color));
147 frame->SetTitle(widget->widget_delegate()->GetWindowTitle());
148 frame->SetShowCloseButton(true);
149 frame->set_can_drag(true);
150 return frame;
137 } 151 }
138 152
139 const DialogClientView* DialogDelegate::GetDialogClientView() const { 153 const DialogClientView* DialogDelegate::GetDialogClientView() const {
140 return GetWidget()->client_view()->AsDialogClientView(); 154 return GetWidget()->client_view()->AsDialogClientView();
141 } 155 }
142 156
143 DialogClientView* DialogDelegate::GetDialogClientView() { 157 DialogClientView* DialogDelegate::GetDialogClientView() {
144 return GetWidget()->client_view()->AsDialogClientView(); 158 return GetWidget()->client_view()->AsDialogClientView();
145 } 159 }
146 160
(...skipping 28 matching lines...) Expand all
175 189
176 const Widget* DialogDelegateView::GetWidget() const { 190 const Widget* DialogDelegateView::GetWidget() const {
177 return View::GetWidget(); 191 return View::GetWidget();
178 } 192 }
179 193
180 View* DialogDelegateView::GetContentsView() { 194 View* DialogDelegateView::GetContentsView() {
181 return this; 195 return this;
182 } 196 }
183 197
184 } // namespace views 198 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | ui/views/window/dialog_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698