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

Side by Side Diff: ui/views/controls/combobox/combobox.cc

Issue 10825254: Remove views::KeyEvent, replacing uses of it with ui::KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
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/controls/combobox/combobox.h" 5 #include "ui/views/controls/combobox/combobox.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/base/accessibility/accessible_view_state.h" 9 #include "ui/base/accessibility/accessible_view_state.h"
10 #include "ui/base/event.h"
10 #include "ui/base/keycodes/keyboard_codes.h" 11 #include "ui/base/keycodes/keyboard_codes.h"
11 #include "ui/base/models/combobox_model.h" 12 #include "ui/base/models/combobox_model.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/views/controls/combobox/combobox_listener.h" 14 #include "ui/views/controls/combobox/combobox_listener.h"
14 #include "ui/views/controls/native/native_view_host.h" 15 #include "ui/views/controls/native/native_view_host.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
16 17
17 namespace views { 18 namespace views {
18 19
19 // static 20 // static
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 85 }
85 86
86 void Combobox::OnEnabledChanged() { 87 void Combobox::OnEnabledChanged() {
87 View::OnEnabledChanged(); 88 View::OnEnabledChanged();
88 if (native_wrapper_) 89 if (native_wrapper_)
89 native_wrapper_->UpdateEnabled(); 90 native_wrapper_->UpdateEnabled();
90 } 91 }
91 92
92 // VKEY_ESCAPE should be handled by this view when the drop down list is active. 93 // VKEY_ESCAPE should be handled by this view when the drop down list is active.
93 // In other words, the list should be closed instead of the dialog. 94 // In other words, the list should be closed instead of the dialog.
94 bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { 95 bool Combobox::SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) {
95 if (e.key_code() != ui::VKEY_ESCAPE || 96 if (e.key_code() != ui::VKEY_ESCAPE ||
96 e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { 97 e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) {
97 return false; 98 return false;
98 } 99 }
99 return native_wrapper_ && native_wrapper_->IsDropdownOpen(); 100 return native_wrapper_ && native_wrapper_->IsDropdownOpen();
100 } 101 }
101 102
102 void Combobox::OnPaintFocusBorder(gfx::Canvas* canvas) { 103 void Combobox::OnPaintFocusBorder(gfx::Canvas* canvas) {
103 if (NativeViewHost::kRenderNativeControlFocus) 104 if (NativeViewHost::kRenderNativeControlFocus)
104 View::OnPaintFocusBorder(canvas); 105 View::OnPaintFocusBorder(canvas);
105 } 106 }
106 107
107 bool Combobox::OnKeyPressed(const views::KeyEvent& e) { 108 bool Combobox::OnKeyPressed(const ui::KeyEvent& e) {
108 return native_wrapper_ && native_wrapper_->HandleKeyPressed(e); 109 return native_wrapper_ && native_wrapper_->HandleKeyPressed(e);
109 } 110 }
110 111
111 bool Combobox::OnKeyReleased(const views::KeyEvent& e) { 112 bool Combobox::OnKeyReleased(const ui::KeyEvent& e) {
112 return native_wrapper_ && native_wrapper_->HandleKeyReleased(e); 113 return native_wrapper_ && native_wrapper_->HandleKeyReleased(e);
113 } 114 }
114 115
115 void Combobox::OnFocus() { 116 void Combobox::OnFocus() {
116 // Forward the focus to the wrapper. 117 // Forward the focus to the wrapper.
117 if (native_wrapper_) 118 if (native_wrapper_)
118 native_wrapper_->SetFocus(); 119 native_wrapper_->SetFocus();
119 else 120 else
120 View::OnFocus(); // Will focus the RootView window (so we still get 121 View::OnFocus(); // Will focus the RootView window (so we still get
121 // keyboard messages). 122 // keyboard messages).
(...skipping 25 matching lines...) Expand all
147 native_wrapper_->UpdateSelectedIndex(); 148 native_wrapper_->UpdateSelectedIndex();
148 native_wrapper_->UpdateEnabled(); 149 native_wrapper_->UpdateEnabled();
149 } 150 }
150 } 151 }
151 152
152 std::string Combobox::GetClassName() const { 153 std::string Combobox::GetClassName() const {
153 return kViewClassName; 154 return kViewClassName;
154 } 155 }
155 156
156 } // namespace views 157 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox.h ('k') | ui/views/controls/combobox/native_combobox_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698