| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/property_bag.h" | 8 #include "base/property_bag.h" | 
| 8 #include "base/logging.h" |  | 
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" | 
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" | 
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" | 
| 12 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 12 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 
| 13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 
| 14 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 14 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 
| 15 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 15 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 
| 16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" | 
| 17 #include "chrome/browser/ui/view_ids.h" | 17 #include "chrome/browser/ui/view_ids.h" | 
| 18 #include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.
     h" |  | 
| 19 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 
|  | 19 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" | 
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" | 
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" | 
| 22 #include "grit/app_locale_settings.h" | 22 #include "grit/app_locale_settings.h" | 
| 23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" | 
| 24 #include "grit/ui_strings.h" | 24 #include "grit/ui_strings.h" | 
| 25 #include "net/base/escape.h" | 25 #include "net/base/escape.h" | 
| 26 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" | 
| 27 #include "ui/base/accessibility/accessible_view_state.h" | 27 #include "ui/base/accessibility/accessible_view_state.h" | 
| 28 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 28 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 
| 29 #include "ui/base/dragdrop/drag_drop_types.h" | 29 #include "ui/base/dragdrop/drag_drop_types.h" | 
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 222   if (popup_window_mode_) | 222   if (popup_window_mode_) | 
| 223     textfield_->SetReadOnly(true); | 223     textfield_->SetReadOnly(true); | 
| 224 | 224 | 
| 225   const int font_size = GetEditFontPixelSize(popup_window_mode_); | 225   const int font_size = GetEditFontPixelSize(popup_window_mode_); | 
| 226   const int old_size = textfield_->font().GetFontSize(); | 226   const int old_size = textfield_->font().GetFontSize(); | 
| 227   if (font_size != old_size) | 227   if (font_size != old_size) | 
| 228     textfield_->SetFont(textfield_->font().DeriveFont(font_size - old_size)); | 228     textfield_->SetFont(textfield_->font().DeriveFont(font_size - old_size)); | 
| 229 | 229 | 
| 230   // Create popup view using the same font as |textfield_|'s. | 230   // Create popup view using the same font as |textfield_|'s. | 
| 231   popup_view_.reset( | 231   popup_view_.reset( | 
| 232       AutocompletePopupContentsView::CreateForEnvironment( | 232       OmniboxPopupContentsView::CreateForEnvironment( | 
| 233           textfield_->font(), this, model_.get(), location_bar_view_)); | 233           textfield_->font(), this, model_.get(), location_bar_view_)); | 
| 234 | 234 | 
| 235   const int vertical_margin = !popup_window_mode_ ? | 235   const int vertical_margin = !popup_window_mode_ ? | 
| 236       kAutocompleteVerticalMargin : kAutocompleteVerticalMarginInPopup; | 236       kAutocompleteVerticalMargin : kAutocompleteVerticalMarginInPopup; | 
| 237   set_border(views::Border::CreateEmptyBorder(vertical_margin, 0, | 237   set_border(views::Border::CreateEmptyBorder(vertical_margin, 0, | 
| 238                                               vertical_margin, 0)); | 238                                               vertical_margin, 0)); | 
| 239 #if defined(OS_CHROMEOS) | 239 #if defined(OS_CHROMEOS) | 
| 240   chromeos::input_method::InputMethodManager::GetInstance()-> | 240   chromeos::input_method::InputMethodManager::GetInstance()-> | 
| 241       AddCandidateWindowObserver(this); | 241       AddCandidateWindowObserver(this); | 
| 242 #endif | 242 #endif | 
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 885                                                const ui::Range& range) { | 885                                                const ui::Range& range) { | 
| 886   if (text != GetText()) | 886   if (text != GetText()) | 
| 887     textfield_->SetText(text); | 887     textfield_->SetText(text); | 
| 888   textfield_->SelectRange(range); | 888   textfield_->SelectRange(range); | 
| 889 } | 889 } | 
| 890 | 890 | 
| 891 string16 OmniboxViewViews::GetSelectedText() const { | 891 string16 OmniboxViewViews::GetSelectedText() const { | 
| 892   // TODO(oshima): Support instant, IME. | 892   // TODO(oshima): Support instant, IME. | 
| 893   return textfield_->GetSelectedText(); | 893   return textfield_->GetSelectedText(); | 
| 894 } | 894 } | 
| OLD | NEW | 
|---|