Chromium Code Reviews| 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 "chrome/browser/autocomplete/autocomplete_edit_view_views.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_views.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 // the contents of omnibox2, we notify the AutocompleteEditModel class when | 184 // the contents of omnibox2, we notify the AutocompleteEditModel class when |
| 185 // the control-key state is changed. | 185 // the control-key state is changed. |
| 186 model_->OnControlKeyChanged(true); | 186 model_->OnControlKeyChanged(true); |
| 187 } else if (!handled && event.key_code() == ui::VKEY_DELETE && | 187 } else if (!handled && event.key_code() == ui::VKEY_DELETE && |
| 188 event.IsShiftDown()) { | 188 event.IsShiftDown()) { |
| 189 // If shift+del didn't change the text, we let this delete an entry from | 189 // If shift+del didn't change the text, we let this delete an entry from |
| 190 // the popup. We can't check to see if the IME handled it because even if | 190 // the popup. We can't check to see if the IME handled it because even if |
| 191 // nothing is selected, the IME or the TextView still report handling it. | 191 // nothing is selected, the IME or the TextView still report handling it. |
| 192 if (model_->popup_model()->IsOpen()) | 192 if (model_->popup_model()->IsOpen()) |
| 193 model_->popup_model()->TryDeletingCurrentItem(); | 193 model_->popup_model()->TryDeletingCurrentItem(); |
| 194 } else if (!handled && event.key_code() == ui::VKEY_UP) { | 194 } else if (!handled && event.key_code() == ui::VKEY_UP) { |
|
Peter Kasting
2011/04/01 00:09:09
You need to rework this function in a similar way
| |
| 195 model_->OnUpOrDownKeyPressed(-1); | 195 model_->OnUpOrDownKeyPressed(-1); |
| 196 handled = true; | 196 handled = true; |
| 197 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { | 197 } else if (!handled && event.key_code() == ui::VKEY_DOWN) { |
| 198 model_->OnUpOrDownKeyPressed(1); | 198 model_->OnUpOrDownKeyPressed(1); |
| 199 handled = true; | 199 handled = true; |
| 200 } else if (!handled && | 200 } else if (!handled && |
| 201 event.key_code() == ui::VKEY_TAB && | 201 event.key_code() == ui::VKEY_TAB && |
| 202 !event.IsShiftDown() && | 202 !event.IsShiftDown() && |
| 203 !event.IsControlDown()) { | 203 !event.IsControlDown()) { |
| 204 if (model_->is_keyword_hint()) { | 204 if (model_->is_keyword_hint()) { |
| 205 handled = model_->AcceptKeyword(); | 205 handled = model_->AcceptKeyword(true); |
| 206 } else { | 206 } else { |
| 207 string16::size_type start = 0; | 207 string16::size_type start = 0; |
| 208 string16::size_type end = 0; | 208 string16::size_type end = 0; |
| 209 size_t length = GetTextLength(); | 209 size_t length = GetTextLength(); |
| 210 GetSelectionBounds(&start, &end); | 210 GetSelectionBounds(&start, &end); |
| 211 if (start != end || start < length) { | 211 if (start != end || start < length) { |
| 212 OnBeforePossibleChange(); | 212 OnBeforePossibleChange(); |
| 213 SelectRange(length, length); | 213 SelectRange(length, length); |
| 214 OnAfterPossibleChange(); | 214 OnAfterPossibleChange(); |
| 215 handled = true; | 215 handled = true; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 AutocompletePopupView* AutocompleteEditViewViews::CreatePopupView( | 643 AutocompletePopupView* AutocompleteEditViewViews::CreatePopupView( |
| 644 Profile* profile, | 644 Profile* profile, |
| 645 const View* location_bar) { | 645 const View* location_bar) { |
| 646 #if defined(TOUCH_UI) | 646 #if defined(TOUCH_UI) |
| 647 return new TouchAutocompletePopupContentsView( | 647 return new TouchAutocompletePopupContentsView( |
| 648 #else | 648 #else |
| 649 return new AutocompletePopupContentsView( | 649 return new AutocompletePopupContentsView( |
| 650 #endif | 650 #endif |
| 651 gfx::Font(), this, model_.get(), profile, location_bar); | 651 gfx::Font(), this, model_.get(), profile, location_bar); |
| 652 } | 652 } |
| OLD | NEW |