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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } // namespace | 123 } // namespace |
124 | 124 |
125 // static | 125 // static |
126 const char OmniboxViewViews::kViewClassName[] = "OmniboxViewViews"; | 126 const char OmniboxViewViews::kViewClassName[] = "OmniboxViewViews"; |
127 | 127 |
128 OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, | 128 OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, |
129 Profile* profile, | 129 Profile* profile, |
130 CommandUpdater* command_updater, | 130 CommandUpdater* command_updater, |
131 bool popup_window_mode, | 131 bool popup_window_mode, |
132 LocationBarView* location_bar, | 132 LocationBarView* location_bar, |
133 const gfx::FontList& font_list, | 133 const gfx::FontList& font_list) |
134 int font_y_offset) | |
135 : OmniboxView(profile, controller, command_updater), | 134 : OmniboxView(profile, controller, command_updater), |
136 popup_window_mode_(popup_window_mode), | 135 popup_window_mode_(popup_window_mode), |
137 security_level_(ToolbarModel::NONE), | 136 security_level_(ToolbarModel::NONE), |
138 saved_selection_for_focus_change_(gfx::Range::InvalidRange()), | 137 saved_selection_for_focus_change_(gfx::Range::InvalidRange()), |
139 ime_composing_before_change_(false), | 138 ime_composing_before_change_(false), |
140 delete_at_end_pressed_(false), | 139 delete_at_end_pressed_(false), |
141 location_bar_view_(location_bar), | 140 location_bar_view_(location_bar), |
142 ime_candidate_window_open_(false), | 141 ime_candidate_window_open_(false), |
143 select_all_on_mouse_release_(false), | 142 select_all_on_mouse_release_(false), |
144 select_all_on_gesture_tap_(false) { | 143 select_all_on_gesture_tap_(false) { |
145 RemoveBorder(); | 144 RemoveBorder(); |
146 set_id(VIEW_ID_OMNIBOX); | 145 set_id(VIEW_ID_OMNIBOX); |
147 SetFontList(font_list); | 146 SetFontList(font_list); |
148 SetVerticalMargins(font_y_offset, 0); | |
149 SetVerticalAlignment(gfx::ALIGN_TOP); | |
150 } | 147 } |
151 | 148 |
152 OmniboxViewViews::~OmniboxViewViews() { | 149 OmniboxViewViews::~OmniboxViewViews() { |
153 #if defined(OS_CHROMEOS) | 150 #if defined(OS_CHROMEOS) |
154 chromeos::input_method::InputMethodManager::Get()-> | 151 chromeos::input_method::InputMethodManager::Get()-> |
155 RemoveCandidateWindowObserver(this); | 152 RemoveCandidateWindowObserver(this); |
156 #endif | 153 #endif |
157 | 154 |
158 // Explicitly teardown members which have a reference to us. Just to be safe | 155 // Explicitly teardown members which have a reference to us. Just to be safe |
159 // we want them to be destroyed before destroying any other internal state. | 156 // we want them to be destroyed before destroying any other internal state. |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 const string16 text(GetClipboardText()); | 954 const string16 text(GetClipboardText()); |
958 if (!text.empty()) { | 955 if (!text.empty()) { |
959 // Record this paste, so we can do different behavior. | 956 // Record this paste, so we can do different behavior. |
960 model()->on_paste(); | 957 model()->on_paste(); |
961 // Force a Paste operation to trigger the text_changed code in | 958 // Force a Paste operation to trigger the text_changed code in |
962 // OnAfterPossibleChange(), even if identical contents are pasted. | 959 // OnAfterPossibleChange(), even if identical contents are pasted. |
963 text_before_change_.clear(); | 960 text_before_change_.clear(); |
964 InsertOrReplaceText(text); | 961 InsertOrReplaceText(text); |
965 } | 962 } |
966 } | 963 } |
OLD | NEW |