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 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2777 | 2777 |
2778 context_menu_contents_.reset(new ui::SimpleMenuModel(this)); | 2778 context_menu_contents_.reset(new ui::SimpleMenuModel(this)); |
2779 // Set up context menu. | 2779 // Set up context menu. |
2780 if (popup_window_mode_) { | 2780 if (popup_window_mode_) { |
2781 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); | 2781 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); |
2782 } else { | 2782 } else { |
2783 context_menu_contents_->AddItemWithStringId(IDS_UNDO, IDS_UNDO); | 2783 context_menu_contents_->AddItemWithStringId(IDS_UNDO, IDS_UNDO); |
2784 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); | 2784 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); |
2785 context_menu_contents_->AddItemWithStringId(IDC_CUT, IDS_CUT); | 2785 context_menu_contents_->AddItemWithStringId(IDC_CUT, IDS_CUT); |
2786 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); | 2786 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); |
2787 if (chrome::IsQueryExtractionEnabled(model()->profile())) | 2787 if (chrome::IsQueryExtractionEnabled()) |
2788 context_menu_contents_->AddItemWithStringId(IDC_COPY_URL, IDS_COPY_URL); | 2788 context_menu_contents_->AddItemWithStringId(IDC_COPY_URL, IDS_COPY_URL); |
2789 context_menu_contents_->AddItemWithStringId(IDC_PASTE, IDS_PASTE); | 2789 context_menu_contents_->AddItemWithStringId(IDC_PASTE, IDS_PASTE); |
2790 // GetContextualLabel() will override this next label with the | 2790 // GetContextualLabel() will override this next label with the |
2791 // IDS_PASTE_AND_SEARCH label as needed. | 2791 // IDS_PASTE_AND_SEARCH label as needed. |
2792 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, | 2792 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, |
2793 IDS_PASTE_AND_GO); | 2793 IDS_PASTE_AND_GO); |
2794 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); | 2794 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); |
2795 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); | 2795 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); |
2796 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); | 2796 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); |
2797 context_menu_contents_->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 2797 context_menu_contents_->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2830 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
2831 } | 2831 } |
2832 | 2832 |
2833 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2833 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
2834 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because | 2834 // Use font_.GetStringWidth() instead of PosFromChar(GetTextLength()) because |
2835 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with | 2835 // PosFromChar() is apparently buggy. In both LTR UI and RTL UI with |
2836 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than | 2836 // left-to-right layout, PosFromChar(i) might return 0 when i is greater than |
2837 // 1. | 2837 // 1. |
2838 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2838 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
2839 } | 2839 } |
OLD | NEW |