| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <locale> | 8 #include <locale> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 bool OmniboxViewWin::IsCommandIdEnabled(int command_id) const { | 1201 bool OmniboxViewWin::IsCommandIdEnabled(int command_id) const { |
| 1202 switch (command_id) { | 1202 switch (command_id) { |
| 1203 case IDS_UNDO: | 1203 case IDS_UNDO: |
| 1204 return !!CanUndo(); | 1204 return !!CanUndo(); |
| 1205 case IDC_CUT: | 1205 case IDC_CUT: |
| 1206 return !!CanCut(); | 1206 return !!CanCut(); |
| 1207 case IDC_COPY: | 1207 case IDC_COPY: |
| 1208 return !!CanCopy(); | 1208 return !!CanCopy(); |
| 1209 case IDC_COPY_URL: | 1209 case IDC_COPY_URL: |
| 1210 return !!CanCopy() && | 1210 return !!CanCopy() && |
| 1211 !model()->user_input_in_progress() && | 1211 !model()->user_input_in_progress() && |
| 1212 toolbar_model()->WouldReplaceSearchURLWithSearchTerms(); | 1212 (toolbar_model()->GetSearchTermsType() != |
| 1213 ToolbarModel::NO_SEARCH_TERMS); |
| 1213 case IDC_PASTE: | 1214 case IDC_PASTE: |
| 1214 return !!CanPaste(); | 1215 return !!CanPaste(); |
| 1215 case IDS_PASTE_AND_GO: | 1216 case IDS_PASTE_AND_GO: |
| 1216 return model()->CanPasteAndGo(GetClipboardText()); | 1217 return model()->CanPasteAndGo(GetClipboardText()); |
| 1217 case IDS_SELECT_ALL: | 1218 case IDS_SELECT_ALL: |
| 1218 return !!CanSelectAll(); | 1219 return !!CanSelectAll(); |
| 1219 case IDC_EDIT_SEARCH_ENGINES: | 1220 case IDC_EDIT_SEARCH_ENGINES: |
| 1220 return command_updater()->IsCommandEnabled(command_id); | 1221 return command_updater()->IsCommandEnabled(command_id); |
| 1221 default: | 1222 default: |
| 1222 NOTREACHED(); | 1223 NOTREACHED(); |
| (...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2856 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2857 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
| 2857 } | 2858 } |
| 2858 | 2859 |
| 2859 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2860 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
| 2860 // Use font_.GetStringWidth() instead of | 2861 // Use font_.GetStringWidth() instead of |
| 2861 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2862 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
| 2862 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2863 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
| 2863 // PosFromChar(i) might return 0 when i is greater than 1. | 2864 // PosFromChar(i) might return 0 when i is greater than 1. |
| 2864 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2865 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2865 } | 2866 } |
| OLD | NEW |