OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |