| 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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 if (something_changed && text_differs) | 862 if (something_changed && text_differs) |
| 863 TextChanged(); | 863 TextChanged(); |
| 864 | 864 |
| 865 return something_changed; | 865 return something_changed; |
| 866 } | 866 } |
| 867 | 867 |
| 868 gfx::NativeView AutocompleteEditViewWin::GetNativeView() const { | 868 gfx::NativeView AutocompleteEditViewWin::GetNativeView() const { |
| 869 return m_hWnd; | 869 return m_hWnd; |
| 870 } | 870 } |
| 871 | 871 |
| 872 gfx::NativeView AutocompleteEditViewWin::GetFocusNativeView() const { |
| 873 return m_hWnd; |
| 874 } |
| 875 |
| 872 void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { | 876 void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { |
| 873 if (CanPasteAndGo(text)) | 877 if (CanPasteAndGo(text)) |
| 874 model_->PasteAndGo(); | 878 model_->PasteAndGo(); |
| 875 } | 879 } |
| 876 | 880 |
| 877 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( | 881 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( |
| 878 const views::KeyEvent& e) { | 882 const views::KeyEvent& e) { |
| 879 int c = e.GetCharacter(); | 883 int c = e.GetCharacter(); |
| 880 // We don't process ALT + numpad digit as accelerators, they are used for | 884 // We don't process ALT + numpad digit as accelerators, they are used for |
| 881 // entering special characters. We do translate alt-home. | 885 // entering special characters. We do translate alt-home. |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 model_->on_paste_replacing_all(); | 1633 model_->on_paste_replacing_all(); |
| 1630 // Force a Paste operation to trigger the text_changed code in | 1634 // Force a Paste operation to trigger the text_changed code in |
| 1631 // OnAfterPossibleChange(), even if identical contents are pasted into the | 1635 // OnAfterPossibleChange(), even if identical contents are pasted into the |
| 1632 // text box. | 1636 // text box. |
| 1633 text_before_change_.clear(); | 1637 text_before_change_.clear(); |
| 1634 ReplaceSel(text.c_str(), true); | 1638 ReplaceSel(text.c_str(), true); |
| 1635 } | 1639 } |
| 1636 } | 1640 } |
| 1637 | 1641 |
| 1638 void AutocompleteEditViewWin::OnSetFocus(HWND focus_wnd) { | 1642 void AutocompleteEditViewWin::OnSetFocus(HWND focus_wnd) { |
| 1639 views::FocusManager* focus_manager = parent_view_->GetFocusManager(); | |
| 1640 if (focus_manager) { | |
| 1641 // Notify the FocusManager that the focused view is now the location bar | |
| 1642 // (our parent view). | |
| 1643 focus_manager->SetFocusedView(parent_view_); | |
| 1644 } else { | |
| 1645 NOTREACHED(); | |
| 1646 } | |
| 1647 | |
| 1648 model_->OnSetFocus(GetKeyState(VK_CONTROL) < 0); | 1643 model_->OnSetFocus(GetKeyState(VK_CONTROL) < 0); |
| 1649 | 1644 |
| 1650 // Notify controller if it needs to show hint UI of some kind. | 1645 // Notify controller if it needs to show hint UI of some kind. |
| 1651 ScopedFreeze freeze(this, GetTextObjectModel()); | 1646 ScopedFreeze freeze(this, GetTextObjectModel()); |
| 1652 if (model_->show_search_hint() || | 1647 if (model_->show_search_hint() || |
| 1653 (model_->is_keyword_hint() && !model_->keyword().empty())) | 1648 (model_->is_keyword_hint() && !model_->keyword().empty())) |
| 1654 controller_->OnChanged(); | 1649 controller_->OnChanged(); |
| 1655 | 1650 |
| 1656 // Restore saved selection if available. | 1651 // Restore saved selection if available. |
| 1657 if (saved_selection_for_focus_change_.cpMin != -1) { | 1652 if (saved_selection_for_focus_change_.cpMin != -1) { |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, | 2370 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, |
| 2376 IDS_PASTE_AND_GO); | 2371 IDS_PASTE_AND_GO); |
| 2377 context_menu_contents_->AddSeparator(); | 2372 context_menu_contents_->AddSeparator(); |
| 2378 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); | 2373 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); |
| 2379 context_menu_contents_->AddSeparator(); | 2374 context_menu_contents_->AddSeparator(); |
| 2380 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, | 2375 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, |
| 2381 IDS_EDIT_SEARCH_ENGINES); | 2376 IDS_EDIT_SEARCH_ENGINES); |
| 2382 } | 2377 } |
| 2383 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); | 2378 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
| 2384 } | 2379 } |
| OLD | NEW |