| 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/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 // static | 134 // static |
| 135 const char OmniboxViewViews::kViewClassName[] = | 135 const char OmniboxViewViews::kViewClassName[] = |
| 136 "browser/ui/views/omnibox/OmniboxViewViews"; | 136 "browser/ui/views/omnibox/OmniboxViewViews"; |
| 137 | 137 |
| 138 OmniboxViewViews::OmniboxViewViews(AutocompleteEditController* controller, | 138 OmniboxViewViews::OmniboxViewViews(AutocompleteEditController* controller, |
| 139 ToolbarModel* toolbar_model, | 139 ToolbarModel* toolbar_model, |
| 140 Profile* profile, | 140 Profile* profile, |
| 141 CommandUpdater* command_updater, | 141 CommandUpdater* command_updater, |
| 142 bool popup_window_mode, | 142 bool popup_window_mode, |
| 143 const views::View* location_bar) | 143 views::View* location_bar) |
| 144 : model_(new AutocompleteEditModel(this, controller, profile)), | 144 : model_(new AutocompleteEditModel(this, controller, profile)), |
| 145 popup_view_(CreatePopupView(profile, location_bar)), | 145 popup_view_(CreatePopupView(profile, location_bar)), |
| 146 controller_(controller), | 146 controller_(controller), |
| 147 toolbar_model_(toolbar_model), | 147 toolbar_model_(toolbar_model), |
| 148 command_updater_(command_updater), | 148 command_updater_(command_updater), |
| 149 popup_window_mode_(popup_window_mode), | 149 popup_window_mode_(popup_window_mode), |
| 150 security_level_(ToolbarModel::NONE), | 150 security_level_(ToolbarModel::NONE), |
| 151 ime_composing_before_change_(false), | 151 ime_composing_before_change_(false), |
| 152 delete_at_end_pressed_(false) { | 152 delete_at_end_pressed_(false) { |
| 153 set_border(views::Border::CreateEmptyBorder(kAutocompleteVerticalMargin, 0, | 153 set_border(views::Border::CreateEmptyBorder(kAutocompleteVerticalMargin, 0, |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 return textfield_->GetSelectedText(); | 683 return textfield_->GetSelectedText(); |
| 684 } | 684 } |
| 685 | 685 |
| 686 void OmniboxViewViews::SelectRange(size_t caret, size_t end) { | 686 void OmniboxViewViews::SelectRange(size_t caret, size_t end) { |
| 687 const ui::Range range(caret, end); | 687 const ui::Range range(caret, end); |
| 688 textfield_->SelectRange(range); | 688 textfield_->SelectRange(range); |
| 689 } | 689 } |
| 690 | 690 |
| 691 AutocompletePopupView* OmniboxViewViews::CreatePopupView( | 691 AutocompletePopupView* OmniboxViewViews::CreatePopupView( |
| 692 Profile* profile, | 692 Profile* profile, |
| 693 const View* location_bar) { | 693 View* location_bar) { |
| 694 #if defined(TOUCH_UI) | 694 #if defined(TOUCH_UI) |
| 695 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; | 695 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; |
| 696 #else | 696 #else |
| 697 typedef AutocompletePopupContentsView AutocompleteContentsView; | 697 typedef AutocompletePopupContentsView AutocompleteContentsView; |
| 698 #endif | 698 #endif |
| 699 return new AutocompleteContentsView( | 699 return new AutocompleteContentsView( |
| 700 gfx::Font(), this, model_.get(), profile, location_bar); | 700 gfx::Font(), this, model_.get(), profile, location_bar); |
| 701 } | 701 } |
| OLD | NEW |