OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/autocomplete/autocomplete_edit_view_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" |
6 | 6 |
7 #include <locale> | 7 #include <locale> |
8 | 8 |
9 #include "base/base_drag_source.h" | 9 #include "base/base_drag_source.h" |
10 #include "base/base_drop_target.h" | 10 #include "base/base_drop_target.h" |
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 | 2010 |
2011 void AutocompleteEditViewWin::TextChanged() { | 2011 void AutocompleteEditViewWin::TextChanged() { |
2012 ScopedFreeze freeze(this, GetTextObjectModel()); | 2012 ScopedFreeze freeze(this, GetTextObjectModel()); |
2013 EmphasizeURLComponents(); | 2013 EmphasizeURLComponents(); |
2014 controller_->OnChanged(); | 2014 controller_->OnChanged(); |
2015 } | 2015 } |
2016 | 2016 |
2017 std::wstring AutocompleteEditViewWin::GetClipboardText() const { | 2017 std::wstring AutocompleteEditViewWin::GetClipboardText() const { |
2018 // Try text format. | 2018 // Try text format. |
2019 ClipboardService* clipboard = g_browser_process->clipboard_service(); | 2019 ClipboardService* clipboard = g_browser_process->clipboard_service(); |
2020 if (clipboard->IsFormatAvailable(CF_UNICODETEXT)) { | 2020 if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType())) { |
2021 std::wstring text; | 2021 std::wstring text; |
2022 clipboard->ReadText(&text); | 2022 clipboard->ReadText(&text); |
2023 | 2023 |
2024 // Note: Unlike in the find popup and textfield view, here we completely | 2024 // Note: Unlike in the find popup and textfield view, here we completely |
2025 // remove whitespace strings containing newlines. We assume users are | 2025 // remove whitespace strings containing newlines. We assume users are |
2026 // most likely pasting in URLs that may have been split into multiple | 2026 // most likely pasting in URLs that may have been split into multiple |
2027 // lines in terminals, email programs, etc., and so linebreaks indicate | 2027 // lines in terminals, email programs, etc., and so linebreaks indicate |
2028 // completely bogus whitespace that would just cause the input to be | 2028 // completely bogus whitespace that would just cause the input to be |
2029 // invalid. | 2029 // invalid. |
2030 return CollapseWhitespace(text, true); | 2030 return CollapseWhitespace(text, true); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 } | 2178 } |
2179 | 2179 |
2180 void AutocompleteEditViewWin::RepaintDropHighlight(int position) { | 2180 void AutocompleteEditViewWin::RepaintDropHighlight(int position) { |
2181 if ((position != -1) && (position <= GetTextLength())) { | 2181 if ((position != -1) && (position <= GetTextLength())) { |
2182 const POINT min_loc(PosFromChar(position)); | 2182 const POINT min_loc(PosFromChar(position)); |
2183 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, | 2183 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, |
2184 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; | 2184 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; |
2185 InvalidateRect(&highlight_bounds, false); | 2185 InvalidateRect(&highlight_bounds, false); |
2186 } | 2186 } |
2187 } | 2187 } |
OLD | NEW |