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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // Returns the width necessary to display the current text, including any | 309 // Returns the width necessary to display the current text, including any |
310 // necessary space for the cursor or border/margin. | 310 // necessary space for the cursor or border/margin. |
311 return GetRenderText()->GetContentWidth() + GetInsets().width(); | 311 return GetRenderText()->GetContentWidth() + GetInsets().width(); |
312 } | 312 } |
313 | 313 |
314 bool OmniboxViewViews::IsImeComposing() const { | 314 bool OmniboxViewViews::IsImeComposing() const { |
315 return IsIMEComposing(); | 315 return IsIMEComposing(); |
316 } | 316 } |
317 | 317 |
318 void OmniboxViewViews::ExecuteCommand(int command_id, int event_flags) { | 318 void OmniboxViewViews::ExecuteCommand(int command_id, int event_flags) { |
| 319 // In the base class, touch text selection is deactivated when a command is |
| 320 // executed. Since we are not always calling the base class implementation |
| 321 // here, we need to deactivate touch text selection here, too. |
| 322 DestroyTouchSelection(); |
319 switch (command_id) { | 323 switch (command_id) { |
320 // These commands don't invoke the popup via OnBefore/AfterPossibleChange(). | 324 // These commands don't invoke the popup via OnBefore/AfterPossibleChange(). |
321 case IDS_PASTE_AND_GO: | 325 case IDS_PASTE_AND_GO: |
322 model()->PasteAndGo(GetClipboardText()); | 326 model()->PasteAndGo(GetClipboardText()); |
323 break; | 327 break; |
324 case IDS_SHOW_URL: | 328 case IDS_SHOW_URL: |
325 controller()->ShowURL(); | 329 controller()->ShowURL(); |
326 break; | 330 break; |
327 case IDC_EDIT_SEARCH_ENGINES: | 331 case IDC_EDIT_SEARCH_ENGINES: |
328 command_updater()->ExecuteCommand(command_id); | 332 command_updater()->ExecuteCommand(command_id); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 menu_contents->InsertItemWithStringIdAt( | 1049 menu_contents->InsertItemWithStringIdAt( |
1046 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1050 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1047 } | 1051 } |
1048 | 1052 |
1049 // Minor note: We use IDC_ for command id here while the underlying textfield | 1053 // Minor note: We use IDC_ for command id here while the underlying textfield |
1050 // is using IDS_ for all its command ids. This is because views cannot depend | 1054 // is using IDS_ for all its command ids. This is because views cannot depend |
1051 // on IDC_ for now. | 1055 // on IDC_ for now. |
1052 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1056 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1053 IDS_EDIT_SEARCH_ENGINES); | 1057 IDS_EDIT_SEARCH_ENGINES); |
1054 } | 1058 } |
OLD | NEW |