| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/controls/combobox/combobox.h" | 5 #include "views/controls/combobox/combobox.h" |
| 6 | 6 |
| 7 #include "app/combobox_model.h" | 7 #include "app/combobox_model.h" |
| 8 #include "app/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "views/controls/combobox/native_combobox_wrapper.h" | 11 #include "views/controls/combobox/native_combobox_wrapper.h" |
| 12 #include "views/controls/native/native_view_host.h" | 12 #include "views/controls/native/native_view_host.h" |
| 13 | 13 |
| 14 namespace views { | 14 namespace views { |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 const char Combobox::kViewClassName[] = "views/Combobox"; | 17 const char Combobox::kViewClassName[] = "views/Combobox"; |
| 18 | 18 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 void Combobox::SetEnabled(bool flag) { | 69 void Combobox::SetEnabled(bool flag) { |
| 70 View::SetEnabled(flag); | 70 View::SetEnabled(flag); |
| 71 if (native_wrapper_) | 71 if (native_wrapper_) |
| 72 native_wrapper_->UpdateEnabled(); | 72 native_wrapper_->UpdateEnabled(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // VKEY_ESCAPE should be handled by this view when the drop down list is active. | 75 // VKEY_ESCAPE should be handled by this view when the drop down list is active. |
| 76 // In other words, the list should be closed instead of the dialog. | 76 // In other words, the list should be closed instead of the dialog. |
| 77 bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { | 77 bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { |
| 78 if (e.GetKeyCode() != app::VKEY_ESCAPE || | 78 if (e.GetKeyCode() != base::VKEY_ESCAPE || |
| 79 e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { | 79 e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { |
| 80 return false; | 80 return false; |
| 81 } | 81 } |
| 82 return native_wrapper_ && native_wrapper_->IsDropdownOpen(); | 82 return native_wrapper_ && native_wrapper_->IsDropdownOpen(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void Combobox::PaintFocusBorder(gfx::Canvas* canvas) { | 85 void Combobox::PaintFocusBorder(gfx::Canvas* canvas) { |
| 86 if (NativeViewHost::kRenderNativeControlFocus) | 86 if (NativeViewHost::kRenderNativeControlFocus) |
| 87 View::PaintFocusBorder(canvas); | 87 View::PaintFocusBorder(canvas); |
| 88 } | 88 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 116 native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); | 116 native_wrapper_ = NativeComboboxWrapper::CreateWrapper(this); |
| 117 AddChildView(native_wrapper_->GetView()); | 117 AddChildView(native_wrapper_->GetView()); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 std::string Combobox::GetClassName() const { | 121 std::string Combobox::GetClassName() const { |
| 122 return kViewClassName; | 122 return kViewClassName; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace views | 125 } // namespace views |
| OLD | NEW |