Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed build problems Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_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 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 void OmniboxViewWin::BuildContextMenu() { 2581 void OmniboxViewWin::BuildContextMenu() {
2582 if (context_menu_contents_.get()) 2582 if (context_menu_contents_.get())
2583 return; 2583 return;
2584 2584
2585 context_menu_contents_.reset(new ui::SimpleMenuModel(this)); 2585 context_menu_contents_.reset(new ui::SimpleMenuModel(this));
2586 // Set up context menu. 2586 // Set up context menu.
2587 if (popup_window_mode_) { 2587 if (popup_window_mode_) {
2588 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); 2588 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY);
2589 } else { 2589 } else {
2590 context_menu_contents_->AddItemWithStringId(IDS_UNDO, IDS_UNDO); 2590 context_menu_contents_->AddItemWithStringId(IDS_UNDO, IDS_UNDO);
2591 context_menu_contents_->AddSeparator(); 2591 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
2592 context_menu_contents_->AddItemWithStringId(IDC_CUT, IDS_CUT); 2592 context_menu_contents_->AddItemWithStringId(IDC_CUT, IDS_CUT);
2593 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY); 2593 context_menu_contents_->AddItemWithStringId(IDC_COPY, IDS_COPY);
2594 context_menu_contents_->AddItemWithStringId(IDC_PASTE, IDS_PASTE); 2594 context_menu_contents_->AddItemWithStringId(IDC_PASTE, IDS_PASTE);
2595 // GetContextualLabel() will override this next label with the 2595 // GetContextualLabel() will override this next label with the
2596 // IDS_PASTE_AND_SEARCH label as needed. 2596 // IDS_PASTE_AND_SEARCH label as needed.
2597 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, 2597 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO,
2598 IDS_PASTE_AND_GO); 2598 IDS_PASTE_AND_GO);
2599 context_menu_contents_->AddSeparator(); 2599 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
2600 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); 2600 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL);
2601 context_menu_contents_->AddSeparator(); 2601 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
2602 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, 2602 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES,
2603 IDS_EDIT_SEARCH_ENGINES); 2603 IDS_EDIT_SEARCH_ENGINES);
2604 } 2604 }
2605 } 2605 }
2606 2606
2607 void OmniboxViewWin::SelectAllIfNecessary(MouseButton button, 2607 void OmniboxViewWin::SelectAllIfNecessary(MouseButton button,
2608 const CPoint& point) { 2608 const CPoint& point) {
2609 // When the user has clicked and released to give us focus, select all. 2609 // When the user has clicked and released to give us focus, select all.
2610 if (tracking_click_[button] && 2610 if (tracking_click_[button] &&
2611 !IsDrag(click_point_[button], point)) { 2611 !IsDrag(click_point_[button], point)) {
(...skipping 23 matching lines...) Expand all
2635 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2635 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2636 } 2636 }
2637 2637
2638 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2638 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2639 // Use font_.GetStringWidth() instead of 2639 // Use font_.GetStringWidth() instead of
2640 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2640 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2641 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2641 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2642 // PosFromChar(i) might return 0 when i is greater than 1. 2642 // PosFromChar(i) might return 0 when i is greater than 1.
2643 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2643 return font_.GetStringWidth(text) + GetHorizontalMargin();
2644 } 2644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698