| 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/autocomplete/autocomplete_popup_contents_view.
h" | |
| 16 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" | |
| 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 15 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 20 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 21 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 22 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 23 #include "net/base/escape.h" | 21 #include "net/base/escape.h" |
| 24 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
| 25 #include "ui/base/accessibility/accessible_view_state.h" | 23 #include "ui/base/accessibility/accessible_view_state.h" |
| 26 #include "ui/base/dragdrop/drag_drop_types.h" | 24 #include "ui/base/dragdrop/drag_drop_types.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 29 #include "ui/gfx/font.h" | 27 #include "ui/gfx/font.h" |
| 30 #include "ui/gfx/render_text.h" | 28 #include "ui/gfx/render_text.h" |
| 31 #include "views/border.h" | 29 #include "views/border.h" |
| 32 #include "views/controls/textfield/textfield.h" | 30 #include "views/controls/textfield/textfield.h" |
| 33 #include "views/layout/fill_layout.h" | 31 #include "views/layout/fill_layout.h" |
| 34 | 32 |
| 33 #if defined(TOUCH_UI) |
| 34 #include "chrome/browser/ui/views/autocomplete/touch_autocomplete_popup_contents
_view.h" |
| 35 #else |
| 36 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
| 37 #endif |
| 38 |
| 35 namespace { | 39 namespace { |
| 36 | 40 |
| 37 // Textfield for autocomplete that intercepts events that are necessary | 41 // Textfield for autocomplete that intercepts events that are necessary |
| 38 // for OmniboxViewViews. | 42 // for OmniboxViewViews. |
| 39 class AutocompleteTextfield : public views::Textfield { | 43 class AutocompleteTextfield : public views::Textfield { |
| 40 public: | 44 public: |
| 41 explicit AutocompleteTextfield(OmniboxViewViews* omnibox_view) | 45 explicit AutocompleteTextfield(OmniboxViewViews* omnibox_view) |
| 42 : views::Textfield(views::Textfield::STYLE_DEFAULT), | 46 : views::Textfield(views::Textfield::STYLE_DEFAULT), |
| 43 omnibox_view_(omnibox_view) { | 47 omnibox_view_(omnibox_view) { |
| 44 DCHECK(omnibox_view_); | 48 DCHECK(omnibox_view_); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 } | 693 } |
| 690 | 694 |
| 691 AutocompletePopupView* OmniboxViewViews::CreatePopupView( | 695 AutocompletePopupView* OmniboxViewViews::CreatePopupView( |
| 692 Profile* profile, | 696 Profile* profile, |
| 693 const View* location_bar) { | 697 const View* location_bar) { |
| 694 #if defined(TOUCH_UI) | 698 #if defined(TOUCH_UI) |
| 695 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; | 699 typedef TouchAutocompletePopupContentsView AutocompleteContentsView; |
| 696 #else | 700 #else |
| 697 typedef AutocompletePopupContentsView AutocompleteContentsView; | 701 typedef AutocompletePopupContentsView AutocompleteContentsView; |
| 698 #endif | 702 #endif |
| 699 return new AutocompleteContentsView( | 703 return new AutocompleteContentsView(gfx::Font(), this, model_.get(), |
| 700 gfx::Font(), this, model_.get(), profile, location_bar); | 704 location_bar); |
| 701 } | 705 } |
| OLD | NEW |