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