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

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

Issue 165073002: Remove deprecated version of views::CreateDialogFrameView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore ConstrainedWebDialogDelegateViewViews::CreateNonClientFrameView. Created 6 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') | no next file » | 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/logging.h" 7 #include "base/logging.h"
8 #include "grit/ui_strings.h" 8 #include "grit/ui_strings.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 #include "ui/views/bubble/bubble_border.h" 10 #include "ui/views/bubble/bubble_border.h"
11 #include "ui/views/bubble/bubble_frame_view.h" 11 #include "ui/views/bubble/bubble_frame_view.h"
12 #include "ui/views/controls/button/label_button.h" 12 #include "ui/views/controls/button/label_button.h"
13 #include "ui/views/corewm/shadow_types.h"
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 #include "ui/views/widget/widget_observer.h" 15 #include "ui/views/widget/widget_observer.h"
15 #include "ui/views/window/dialog_client_view.h" 16 #include "ui/views/window/dialog_client_view.h"
16 17
17 #if defined(USE_AURA)
18 #include "ui/views/corewm/shadow_types.h"
19 #endif
20
21 namespace views { 18 namespace views {
22 19
23 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
24 // DialogDelegate: 21 // DialogDelegate:
25 22
26 DialogDelegate::~DialogDelegate() { 23 DialogDelegate::~DialogDelegate() {
27 } 24 }
28 25
29 // static 26 // static
30 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog, 27 Widget* DialogDelegate::CreateDialogWidget(DialogDelegate* dialog,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 148 }
152 149
153 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { 150 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) {
154 if (UseNewStyleForThisDialog()) 151 if (UseNewStyleForThisDialog())
155 return CreateDialogFrameView(widget); 152 return CreateDialogFrameView(widget);
156 return WidgetDelegate::CreateNonClientFrameView(widget); 153 return WidgetDelegate::CreateNonClientFrameView(widget);
157 } 154 }
158 155
159 // static 156 // static
160 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { 157 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) {
161 return CreateDialogFrameView(widget, false);
162 }
163
164 // static
165 NonClientFrameView* DialogDelegate::CreateDialogFrameView(
166 Widget* widget,
167 bool force_opaque_border) {
168 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); 158 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets());
169 const SkColor color = widget->GetNativeTheme()->GetSystemColor( 159 const SkColor color = widget->GetNativeTheme()->GetSystemColor(
170 ui::NativeTheme::kColorId_DialogBackground); 160 ui::NativeTheme::kColorId_DialogBackground);
171 if (force_opaque_border) { 161 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>(new BubbleBorder(
172 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>(new BubbleBorder( 162 BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, color)));
173 BubbleBorder::NONE, BubbleBorder::NO_SHADOW_OPAQUE_BORDER, color)));
174 } else {
175 frame->SetBubbleBorder(scoped_ptr<BubbleBorder>(new BubbleBorder(
176 BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, color)));
177 }
178 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); 163 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate();
179 if (delegate) { 164 if (delegate) {
180 View* titlebar_view = delegate->CreateTitlebarExtraView(); 165 View* titlebar_view = delegate->CreateTitlebarExtraView();
181 if (titlebar_view) 166 if (titlebar_view)
182 frame->SetTitlebarExtraView(titlebar_view); 167 frame->SetTitlebarExtraView(titlebar_view);
183 } 168 }
184 if (force_opaque_border)
185 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
186 #if defined(USE_AURA)
187 // TODO(msw): Add a matching shadow type and remove the bubble frame border? 169 // TODO(msw): Add a matching shadow type and remove the bubble frame border?
188 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE); 170 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE);
189 #endif
190 return frame; 171 return frame;
191 } 172 }
192 173
193 bool DialogDelegate::UseNewStyleForThisDialog() const { 174 bool DialogDelegate::UseNewStyleForThisDialog() const {
194 return true; 175 return true;
195 } 176 }
196 177
197 const DialogClientView* DialogDelegate::GetDialogClientView() const { 178 const DialogClientView* DialogDelegate::GetDialogClientView() const {
198 return GetWidget()->client_view()->AsDialogClientView(); 179 return GetWidget()->client_view()->AsDialogClientView();
199 } 180 }
(...skipping 26 matching lines...) Expand all
226 207
227 const Widget* DialogDelegateView::GetWidget() const { 208 const Widget* DialogDelegateView::GetWidget() const {
228 return View::GetWidget(); 209 return View::GetWidget();
229 } 210 }
230 211
231 View* DialogDelegateView::GetContentsView() { 212 View* DialogDelegateView::GetContentsView() {
232 return this; 213 return this;
233 } 214 }
234 215
235 } // namespace views 216 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/dialog_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698