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

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

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 virtual ~AutocompleteEditState() {} 115 virtual ~AutocompleteEditState() {}
116 116
117 const OmniboxEditModel::State model_state; 117 const OmniboxEditModel::State model_state;
118 const OmniboxViewWin::State view_state; 118 const OmniboxViewWin::State view_state;
119 }; 119 };
120 120
121 // Returns true if the current point is far enough from the origin that it 121 // Returns true if the current point is far enough from the origin that it
122 // would be considered a drag. 122 // would be considered a drag.
123 bool IsDrag(const POINT& origin, const POINT& current) { 123 bool IsDrag(const POINT& origin, const POINT& current) {
124 return views::View::ExceededDragThreshold(current.x - origin.x, 124 return views::View::ExceededDragThreshold(
125 current.y - origin.y); 125 gfx::Point(current) - gfx::Point(origin));
126 } 126 }
127 127
128 // Write |text| and an optional |url| to the clipboard. 128 // Write |text| and an optional |url| to the clipboard.
129 void DoCopy(const string16& text, const GURL* url) { 129 void DoCopy(const string16& text, const GURL* url) {
130 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(), 130 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(),
131 ui::Clipboard::BUFFER_STANDARD); 131 ui::Clipboard::BUFFER_STANDARD);
132 scw.WriteText(text); 132 scw.WriteText(text);
133 if (url != NULL) 133 if (url != NULL)
134 scw.WriteBookmark(text, url->spec()); 134 scw.WriteBookmark(text, url->spec());
135 } 135 }
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2750 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2751 } 2751 }
2752 2752
2753 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2753 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2754 // Use font_.GetStringWidth() instead of 2754 // Use font_.GetStringWidth() instead of
2755 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2755 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2756 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2756 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2757 // PosFromChar(i) might return 0 when i is greater than 1. 2757 // PosFromChar(i) might return 0 when i is greater than 1.
2758 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2758 return font_.GetStringWidth(text) + GetHorizontalMargin();
2759 } 2759 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698