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

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

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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
« views/accelerator.h ('K') | « views/window/dialog_client_view.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/window/dialog_client_view.h" 5 #include "views/window/dialog_client_view.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ui::DialogButton type, 70 ui::DialogButton type,
71 const string16& title, 71 const string16& title,
72 bool is_default) 72 bool is_default)
73 : NativeTextButton(listener, title), 73 : NativeTextButton(listener, title),
74 owner_(owner), 74 owner_(owner),
75 type_(type) { 75 type_(type) {
76 SetIsDefault(is_default); 76 SetIsDefault(is_default);
77 } 77 }
78 78
79 // Overridden to forward to the delegate. 79 // Overridden to forward to the delegate.
80 virtual bool AcceleratorPressed(const Accelerator& accelerator) { 80 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) {
81 if (!owner_->widget_delegate()->AsDialogDelegate()-> 81 if (!owner_->widget_delegate()->AsDialogDelegate()->
82 AreAcceleratorsEnabled(type_)) { 82 AreAcceleratorsEnabled(type_)) {
83 return false; 83 return false;
84 } 84 }
85 return NativeTextButton::AcceleratorPressed(accelerator); 85 return NativeTextButton::AcceleratorPressed(accelerator);
86 } 86 }
87 87
88 private: 88 private:
89 Widget* owner_; 89 Widget* owner_;
90 const ui::DialogButton type_; 90 const ui::DialogButton type_;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 } 396 }
397 if (bottom_view_) { 397 if (bottom_view_) {
398 gfx::Size bottom_pref = bottom_view_->GetPreferredSize(); 398 gfx::Size bottom_pref = bottom_view_->GetPreferredSize();
399 prefsize.Enlarge(0, bottom_pref.height() + kButtonVEdgeMargin); 399 prefsize.Enlarge(0, bottom_pref.height() + kButtonVEdgeMargin);
400 } 400 }
401 prefsize.Enlarge(0, button_height); 401 prefsize.Enlarge(0, button_height);
402 return prefsize; 402 return prefsize;
403 } 403 }
404 404
405 bool DialogClientView::AcceleratorPressed(const Accelerator& accelerator) { 405 bool DialogClientView::AcceleratorPressed(const ui::Accelerator& accelerator) {
406 // We only expect Escape key. 406 // We only expect Escape key.
407 DCHECK(accelerator.key_code() == ui::VKEY_ESCAPE); 407 DCHECK(accelerator.key_code() == ui::VKEY_ESCAPE);
408 Close(); 408 Close();
409 return true; 409 return true;
410 } 410 }
411 411
412 //////////////////////////////////////////////////////////////////////////////// 412 ////////////////////////////////////////////////////////////////////////////////
413 // DialogClientView, ButtonListener implementation: 413 // DialogClientView, ButtonListener implementation:
414 414
415 void DialogClientView::ButtonPressed( 415 void DialogClientView::ButtonPressed(
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 void DialogClientView::InitClass() { 578 void DialogClientView::InitClass() {
579 static bool initialized = false; 579 static bool initialized = false;
580 if (!initialized) { 580 if (!initialized) {
581 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 581 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
582 dialog_button_font_ = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); 582 dialog_button_font_ = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont));
583 initialized = true; 583 initialized = true;
584 } 584 }
585 } 585 }
586 586
587 } // namespace views 587 } // namespace views
OLDNEW
« views/accelerator.h ('K') | « views/window/dialog_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698