| 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" |
| 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/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 16 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" | 16 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
h" |
| 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 18 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
| 19 #include "gfx/font.h" | 19 #include "gfx/font.h" |
| 20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "net/base/escape.h" | 22 #include "net/base/escape.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "views/border.h" | 24 #include "views/border.h" |
| 25 #include "views/fill_layout.h" | 25 #include "views/layout/fill_layout.h" |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // Textfield for autocomplete that intercepts events that are necessary | 29 // Textfield for autocomplete that intercepts events that are necessary |
| 30 // for AutocompleteEditViewViews. | 30 // for AutocompleteEditViewViews. |
| 31 class AutocompleteTextfield : public views::Textfield { | 31 class AutocompleteTextfield : public views::Textfield { |
| 32 public: | 32 public: |
| 33 explicit AutocompleteTextfield( | 33 explicit AutocompleteTextfield( |
| 34 AutocompleteEditViewViews* autocomplete_edit_view) | 34 AutocompleteEditViewViews* autocomplete_edit_view) |
| 35 : views::Textfield(views::Textfield::STYLE_DEFAULT), | 35 : views::Textfield(views::Textfield::STYLE_DEFAULT), |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 | 628 |
| 629 string16 AutocompleteEditViewViews::GetSelectedText() const { | 629 string16 AutocompleteEditViewViews::GetSelectedText() const { |
| 630 // TODO(oshima): Support instant, IME. | 630 // TODO(oshima): Support instant, IME. |
| 631 return textfield_->GetSelectedText(); | 631 return textfield_->GetSelectedText(); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void AutocompleteEditViewViews::SelectRange(size_t caret, size_t end) { | 634 void AutocompleteEditViewViews::SelectRange(size_t caret, size_t end) { |
| 635 const views::TextRange range(caret, end); | 635 const views::TextRange range(caret, end); |
| 636 textfield_->SelectRange(range); | 636 textfield_->SelectRange(range); |
| 637 } | 637 } |
| OLD | NEW |