| 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" |
| 11 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 11 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_match.h" | 12 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 13 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 14 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
| 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
| 22 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
| 23 #include "ui/base/accessibility/accessible_view_state.h" | 23 #include "ui/base/accessibility/accessible_view_state.h" |
| 24 #include "ui/base/dragdrop/drag_drop_types.h" | 24 #include "ui/base/dragdrop/drag_drop_types.h" |
| 25 #include "ui/base/ime/text_input_type.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/font.h" | 28 #include "ui/gfx/font.h" |
| 28 #include "ui/gfx/render_text.h" | 29 #include "ui/gfx/render_text.h" |
| 29 #include "views/border.h" | 30 #include "views/border.h" |
| 30 #include "views/controls/textfield/textfield.h" | 31 #include "views/controls/textfield/textfield.h" |
| 31 #include "views/layout/fill_layout.h" | 32 #include "views/layout/fill_layout.h" |
| 32 | 33 |
| 33 #if defined(TOUCH_UI) | 34 #if defined(TOUCH_UI) |
| 34 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" | 35 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 168 |
| 168 //////////////////////////////////////////////////////////////////////////////// | 169 //////////////////////////////////////////////////////////////////////////////// |
| 169 // OmniboxViewViews public: | 170 // OmniboxViewViews public: |
| 170 | 171 |
| 171 void OmniboxViewViews::Init() { | 172 void OmniboxViewViews::Init() { |
| 172 // The height of the text view is going to change based on the font used. We | 173 // The height of the text view is going to change based on the font used. We |
| 173 // don't want to stretch the height, and we want it vertically centered. | 174 // don't want to stretch the height, and we want it vertically centered. |
| 174 // TODO(oshima): make sure the above happens with views. | 175 // TODO(oshima): make sure the above happens with views. |
| 175 textfield_ = new AutocompleteTextfield(this); | 176 textfield_ = new AutocompleteTextfield(this); |
| 176 textfield_->SetController(this); | 177 textfield_->SetController(this); |
| 178 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_URL); |
| 177 | 179 |
| 178 #if defined(TOUCH_UI) | 180 #if defined(TOUCH_UI) |
| 179 textfield_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( | 181 textfield_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( |
| 180 ResourceBundle::LargeFont)); | 182 ResourceBundle::LargeFont)); |
| 181 #endif | 183 #endif |
| 182 | 184 |
| 183 if (popup_window_mode_) | 185 if (popup_window_mode_) |
| 184 textfield_->SetReadOnly(true); | 186 textfield_->SetReadOnly(true); |
| 185 | 187 |
| 186 // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe | 188 // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 AutocompletePopupView* OmniboxViewViews::CreatePopupView( | 697 AutocompletePopupView* OmniboxViewViews::CreatePopupView( |
| 696 View* location_bar) { | 698 View* location_bar) { |
| 697 #if defined(TOUCH_UI) | 699 #if defined(TOUCH_UI) |
| 698 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; | 700 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; |
| 699 #else | 701 #else |
| 700 typedef AutocompletePopupContentsView AutocompleteContentsView; | 702 typedef AutocompletePopupContentsView AutocompleteContentsView; |
| 701 #endif | 703 #endif |
| 702 return new AutocompleteContentsView(gfx::Font(), this, model_.get(), | 704 return new AutocompleteContentsView(gfx::Font(), this, model_.get(), |
| 703 location_bar); | 705 location_bar); |
| 704 } | 706 } |
| OLD | NEW |