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

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

Issue 10911074: Change how ui::Clipboard is accessed so there's only one per thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch cleanup Created 8 years, 3 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 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 if (text.empty()) 1326 if (text.empty())
1327 return; 1327 return;
1328 1328
1329 CHARRANGE sel; 1329 CHARRANGE sel;
1330 GURL url; 1330 GURL url;
1331 bool write_url = false; 1331 bool write_url = false;
1332 GetSel(sel); 1332 GetSel(sel);
1333 // GetSel() doesn't preserve selection direction, so sel.cpMin will always be 1333 // GetSel() doesn't preserve selection direction, so sel.cpMin will always be
1334 // the smaller value. 1334 // the smaller value.
1335 model()->AdjustTextForCopy(sel.cpMin, IsSelectAll(), &text, &url, &write_url); 1335 model()->AdjustTextForCopy(sel.cpMin, IsSelectAll(), &text, &url, &write_url);
1336 ui::ScopedClipboardWriter scw(g_browser_process->clipboard(), 1336 ui::ScopedClipboardWriter scw(ui::Clipboard::GetForCurrentThread(),
1337 ui::Clipboard::BUFFER_STANDARD); 1337 ui::Clipboard::BUFFER_STANDARD);
1338 scw.WriteText(text); 1338 scw.WriteText(text);
1339 if (write_url) 1339 if (write_url)
1340 scw.WriteBookmark(text, url.spec()); 1340 scw.WriteBookmark(text, url.spec());
1341 } 1341 }
1342 1342
1343 LRESULT OmniboxViewWin::OnCreate(const CREATESTRUCTW* /*create_struct*/) { 1343 LRESULT OmniboxViewWin::OnCreate(const CREATESTRUCTW* /*create_struct*/) {
1344 if (base::win::IsTsfAwareRequired()) { 1344 if (base::win::IsTsfAwareRequired()) {
1345 // Enable TSF support of RichEdit. 1345 // Enable TSF support of RichEdit.
1346 SetEditStyle(SES_USECTF, SES_USECTF); 1346 SetEditStyle(SES_USECTF, SES_USECTF);
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2641 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2642 } 2642 }
2643 2643
2644 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2644 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2645 // Use font_.GetStringWidth() instead of 2645 // Use font_.GetStringWidth() instead of
2646 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2646 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2647 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2647 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2648 // PosFromChar(i) might return 0 when i is greater than 1. 2648 // PosFromChar(i) might return 0 when i is greater than 1.
2649 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2649 return font_.GetStringWidth(text) + GetHorizontalMargin();
2650 } 2650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698