OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 return false; | 1004 return false; |
1005 } | 1005 } |
1006 } | 1006 } |
1007 | 1007 |
1008 bool AutocompleteEditViewWin::GetAcceleratorForCommandId( | 1008 bool AutocompleteEditViewWin::GetAcceleratorForCommandId( |
1009 int command_id, | 1009 int command_id, |
1010 menus::Accelerator* accelerator) { | 1010 menus::Accelerator* accelerator) { |
1011 return parent_view_->GetWidget()->GetAccelerator(command_id, accelerator); | 1011 return parent_view_->GetWidget()->GetAccelerator(command_id, accelerator); |
1012 } | 1012 } |
1013 | 1013 |
1014 bool AutocompleteEditViewWin::IsLabelForCommandIdDynamic(int command_id) const { | 1014 bool AutocompleteEditViewWin::IsItemForCommandIdDynamic(int command_id) const { |
1015 // No need to change the default IDS_PASTE_AND_GO label unless this is a | 1015 // No need to change the default IDS_PASTE_AND_GO label unless this is a |
1016 // search. | 1016 // search. |
1017 return command_id == IDS_PASTE_AND_GO; | 1017 return command_id == IDS_PASTE_AND_GO; |
1018 } | 1018 } |
1019 | 1019 |
1020 std::wstring AutocompleteEditViewWin::GetLabelForCommandId( | 1020 std::wstring AutocompleteEditViewWin::GetLabelForCommandId( |
1021 int command_id) const { | 1021 int command_id) const { |
1022 DCHECK(command_id == IDS_PASTE_AND_GO); | 1022 DCHECK(command_id == IDS_PASTE_AND_GO); |
1023 return l10n_util::GetString(model_->is_paste_and_search() ? | 1023 return l10n_util::GetString(model_->is_paste_and_search() ? |
1024 IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO); | 1024 IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO); |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2586 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2587 } | 2587 } |
2588 | 2588 |
2589 int AutocompleteEditViewWin::WidthNeededToDisplay(const std::wstring& text) { | 2589 int AutocompleteEditViewWin::WidthNeededToDisplay(const std::wstring& text) { |
2590 // Use font_.GetStringWidth() instead of | 2590 // Use font_.GetStringWidth() instead of |
2591 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2591 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
2592 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2592 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
2593 // PosFromChar(i) might return 0 when i is greater than 1. | 2593 // PosFromChar(i) might return 0 when i is greater than 1. |
2594 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2594 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2595 } | 2595 } |
OLD | NEW |