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

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

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 years, 6 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 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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 gfx::Point location(point); 1414 gfx::Point location(point);
1415 if (point.x == -1 || point.y == -1) { 1415 if (point.x == -1 || point.y == -1) {
1416 POINT p; 1416 POINT p;
1417 GetCaretPos(&p); 1417 GetCaretPos(&p);
1418 MapWindowPoints(HWND_DESKTOP, &p, 1); 1418 MapWindowPoints(HWND_DESKTOP, &p, 1);
1419 location.SetPoint(p.x, p.y); 1419 location.SetPoint(p.x, p.y);
1420 } 1420 }
1421 1421
1422 ignore_result(context_menu_runner_->RunMenuAt(native_view_host_->GetWidget(), 1422 ignore_result(context_menu_runner_->RunMenuAt(native_view_host_->GetWidget(),
1423 NULL, gfx::Rect(location, gfx::Size()), views::MenuItemView::TOPLEFT, 1423 NULL, gfx::Rect(location, gfx::Size()), views::MenuItemView::TOPLEFT,
1424 views::MenuRunner::HAS_MNEMONICS)); 1424 ui::MENU_SOURCE_MOUSE, views::MenuRunner::HAS_MNEMONICS));
1425 } 1425 }
1426 1426
1427 void OmniboxViewWin::OnCopy() { 1427 void OmniboxViewWin::OnCopy() {
1428 string16 text(GetSelectedText()); 1428 string16 text(GetSelectedText());
1429 if (text.empty()) 1429 if (text.empty())
1430 return; 1430 return;
1431 1431
1432 CHARRANGE sel; 1432 CHARRANGE sel;
1433 GURL url; 1433 GURL url;
1434 bool write_url = false; 1434 bool write_url = false;
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/notifications/balloon_view_views.cc ('k') | chrome/browser/ui/views/reload_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698