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

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

Issue 15731007: Add dialog-specific styling, restore old-style task manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « chrome/browser/ui/views/task_manager_view.cc ('k') | ui/views/window/dialog_delegate.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_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/base/keycodes/keyboard_codes.h" 9 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "ui/views/controls/button/label_button.h" 10 #include "ui/views/controls/button/label_button.h"
(...skipping 22 matching lines...) Expand all
33 33
34 DialogClientView::DialogClientView(Widget* owner, View* contents_view) 34 DialogClientView::DialogClientView(Widget* owner, View* contents_view)
35 : ClientView(owner, contents_view), 35 : ClientView(owner, contents_view),
36 ok_button_(NULL), 36 ok_button_(NULL),
37 cancel_button_(NULL), 37 cancel_button_(NULL),
38 default_button_(NULL), 38 default_button_(NULL),
39 focus_manager_(NULL), 39 focus_manager_(NULL),
40 extra_view_(NULL), 40 extra_view_(NULL),
41 footnote_view_(NULL), 41 footnote_view_(NULL),
42 notified_delegate_(false) { 42 notified_delegate_(false) {
43 // When using the new style, the background color is set on the bubble frame,
44 // so a transparent background is fine.
45 if (!DialogDelegate::UseNewStyle()) {
46 const SkColor color = owner->GetNativeTheme()->GetSystemColor(
47 ui::NativeTheme::kColorId_DialogBackground);
48 set_background(views::Background::CreateSolidBackground(color));
49 }
50 } 43 }
51 44
52 DialogClientView::~DialogClientView() { 45 DialogClientView::~DialogClientView() {
53 if (focus_manager_) 46 if (focus_manager_)
54 focus_manager_->RemoveFocusChangeListener(this); 47 focus_manager_->RemoveFocusChangeListener(this);
55 focus_manager_ = NULL; 48 focus_manager_ = NULL;
56 } 49 }
57 50
58 void DialogClientView::AcceptWindow() { 51 void DialogClientView::AcceptWindow() {
59 // Only notify the delegate once. See |notified_delegate_|'s comment. 52 // Only notify the delegate once. See |notified_delegate_|'s comment.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) { 249 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) {
257 DCHECK_EQ(accelerator.key_code(), ui::VKEY_ESCAPE); 250 DCHECK_EQ(accelerator.key_code(), ui::VKEY_ESCAPE);
258 Close(); 251 Close();
259 return true; 252 return true;
260 } 253 }
261 254
262 void DialogClientView::ViewHierarchyChanged( 255 void DialogClientView::ViewHierarchyChanged(
263 const ViewHierarchyChangedDetails& details) { 256 const ViewHierarchyChangedDetails& details) {
264 ClientView::ViewHierarchyChanged(details); 257 ClientView::ViewHierarchyChanged(details);
265 if (details.is_add && details.child == this) { 258 if (details.is_add && details.child == this) {
259 // The old dialog style needs an explicit background color, while the new
260 // dialog style simply inherits the bubble's frame view color.
261 const DialogDelegate* dialog = GetDialogDelegate();
262 const bool use_new_style = dialog ?
263 dialog->UseNewStyleForThisDialog() : DialogDelegate::UseNewStyle();
264 if (!use_new_style)
265 set_background(views::Background::CreateSolidBackground(GetNativeTheme()->
266 GetSystemColor(ui::NativeTheme::kColorId_DialogBackground)));
267
266 focus_manager_ = GetFocusManager(); 268 focus_manager_ = GetFocusManager();
267 if (focus_manager_) 269 if (focus_manager_)
268 GetFocusManager()->AddFocusChangeListener(this); 270 GetFocusManager()->AddFocusChangeListener(this);
269 271
270 UpdateDialogButtons(); 272 UpdateDialogButtons();
271 CreateExtraView(); 273 CreateExtraView();
272 CreateFootnoteView(); 274 CreateFootnoteView();
273 } 275 }
274 } 276 }
275 277
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 gfx::Insets(0, kButtonHEdgeMargin, 384 gfx::Insets(0, kButtonHEdgeMargin,
383 kButtonVEdgeMargin, kButtonHEdgeMargin); 385 kButtonVEdgeMargin, kButtonHEdgeMargin);
384 } 386 }
385 387
386 void DialogClientView::Close() { 388 void DialogClientView::Close() {
387 GetWidget()->Close(); 389 GetWidget()->Close();
388 GetDialogDelegate()->OnClose(); 390 GetDialogDelegate()->OnClose();
389 } 391 }
390 392
391 } // namespace views 393 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/task_manager_view.cc ('k') | ui/views/window/dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698