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

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

Issue 15667004: Add resize support for Views new style dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « 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/base/ui_base_switches_util.h" 10 #include "ui/base/ui_base_switches_util.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return dcv->ok_button(); 143 return dcv->ok_button();
144 if (default_button & ui::DIALOG_BUTTON_CANCEL) 144 if (default_button & ui::DIALOG_BUTTON_CANCEL)
145 return dcv->cancel_button(); 145 return dcv->cancel_button();
146 return NULL; 146 return NULL;
147 } 147 }
148 148
149 DialogDelegate* DialogDelegate::AsDialogDelegate() { 149 DialogDelegate* DialogDelegate::AsDialogDelegate() {
150 return this; 150 return this;
151 } 151 }
152 152
153 bool DialogDelegate::CanResize() const {
154 return true;
sky 2013/05/23 14:44:11 Won't this make all dialogs resizable?
msw 2013/05/23 19:30:04 Doh! Removed, thanks for the catch.
155 }
156
153 ClientView* DialogDelegate::CreateClientView(Widget* widget) { 157 ClientView* DialogDelegate::CreateClientView(Widget* widget) {
154 return new DialogClientView(widget, GetContentsView()); 158 return new DialogClientView(widget, GetContentsView());
155 } 159 }
156 160
157 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { 161 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) {
158 return UseNewStyle() ? CreateNewStyleFrameView(widget) : 162 return UseNewStyle() ? CreateNewStyleFrameView(widget) :
159 WidgetDelegate::CreateNonClientFrameView(widget); 163 WidgetDelegate::CreateNonClientFrameView(widget);
160 } 164 }
161 165
162 // static 166 // static
(...skipping 18 matching lines...) Expand all
181 color)); 185 color));
182 } 186 }
183 frame->SetTitle(widget->widget_delegate()->GetWindowTitle()); 187 frame->SetTitle(widget->widget_delegate()->GetWindowTitle());
184 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); 188 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate();
185 if (delegate) { 189 if (delegate) {
186 View* titlebar_view = delegate->CreateTitlebarExtraView(); 190 View* titlebar_view = delegate->CreateTitlebarExtraView();
187 if (titlebar_view) 191 if (titlebar_view)
188 frame->SetTitlebarExtraView(titlebar_view); 192 frame->SetTitlebarExtraView(titlebar_view);
189 } 193 }
190 frame->SetShowCloseButton(widget->widget_delegate()->ShouldShowCloseButton()); 194 frame->SetShowCloseButton(widget->widget_delegate()->ShouldShowCloseButton());
191 frame->set_can_drag(true);
192 if (force_opaque_border) 195 if (force_opaque_border)
193 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); 196 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM);
194 return frame; 197 return frame;
195 } 198 }
196 199
197 const DialogClientView* DialogDelegate::GetDialogClientView() const { 200 const DialogClientView* DialogDelegate::GetDialogClientView() const {
198 return GetWidget()->client_view()->AsDialogClientView(); 201 return GetWidget()->client_view()->AsDialogClientView();
199 } 202 }
200 203
201 DialogClientView* DialogDelegate::GetDialogClientView() { 204 DialogClientView* DialogDelegate::GetDialogClientView() {
(...skipping 24 matching lines...) Expand all
226 229
227 const Widget* DialogDelegateView::GetWidget() const { 230 const Widget* DialogDelegateView::GetWidget() const {
228 return View::GetWidget(); 231 return View::GetWidget();
229 } 232 }
230 233
231 View* DialogDelegateView::GetContentsView() { 234 View* DialogDelegateView::GetContentsView() {
232 return this; 235 return this;
233 } 236 }
234 237
235 } // namespace views 238 } // 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