| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 model_->on_paste_replacing_all(); | 1614 model_->on_paste_replacing_all(); |
| 1615 // Force a Paste operation to trigger the text_changed code in | 1615 // Force a Paste operation to trigger the text_changed code in |
| 1616 // OnAfterPossibleChange(), even if identical contents are pasted into the | 1616 // OnAfterPossibleChange(), even if identical contents are pasted into the |
| 1617 // text box. | 1617 // text box. |
| 1618 text_before_change_.clear(); | 1618 text_before_change_.clear(); |
| 1619 ReplaceSel(text.c_str(), true); | 1619 ReplaceSel(text.c_str(), true); |
| 1620 } | 1620 } |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 void AutocompleteEditViewWin::OnSetFocus(HWND focus_wnd) { | 1623 void AutocompleteEditViewWin::OnSetFocus(HWND focus_wnd) { |
| 1624 views::FocusManager* focus_manager = |
| 1625 views::FocusManager::GetFocusManager(m_hWnd); |
| 1626 if (focus_manager) { |
| 1627 // Notify the FocusManager that the focused view is now the location bar |
| 1628 // (our parent view). |
| 1629 focus_manager->SetFocusedView(parent_view_); |
| 1630 } else { |
| 1631 NOTREACHED(); |
| 1632 } |
| 1633 |
| 1624 model_->OnSetFocus(GetKeyState(VK_CONTROL) < 0); | 1634 model_->OnSetFocus(GetKeyState(VK_CONTROL) < 0); |
| 1625 | 1635 |
| 1626 // Notify controller if it needs to show hint UI of some kind. | 1636 // Notify controller if it needs to show hint UI of some kind. |
| 1627 ScopedFreeze freeze(this, GetTextObjectModel()); | 1637 ScopedFreeze freeze(this, GetTextObjectModel()); |
| 1628 if (model_->show_search_hint() || | 1638 if (model_->show_search_hint() || |
| 1629 (model_->is_keyword_hint() && !model_->keyword().empty())) | 1639 (model_->is_keyword_hint() && !model_->keyword().empty())) |
| 1630 controller_->OnChanged(); | 1640 controller_->OnChanged(); |
| 1631 | 1641 |
| 1632 // Restore saved selection if available. | 1642 // Restore saved selection if available. |
| 1633 if (saved_selection_for_focus_change_.cpMin != -1) { | 1643 if (saved_selection_for_focus_change_.cpMin != -1) { |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 } | 2322 } |
| 2313 | 2323 |
| 2314 void AutocompleteEditViewWin::RepaintDropHighlight(int position) { | 2324 void AutocompleteEditViewWin::RepaintDropHighlight(int position) { |
| 2315 if ((position != -1) && (position <= GetTextLength())) { | 2325 if ((position != -1) && (position <= GetTextLength())) { |
| 2316 const POINT min_loc(PosFromChar(position)); | 2326 const POINT min_loc(PosFromChar(position)); |
| 2317 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, | 2327 const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_, |
| 2318 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; | 2328 min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_}; |
| 2319 InvalidateRect(&highlight_bounds, false); | 2329 InvalidateRect(&highlight_bounds, false); |
| 2320 } | 2330 } |
| 2321 } | 2331 } |
| OLD | NEW |