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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_win.cc

Issue 231022: Reverting 27113. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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) 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
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
876 void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { 872 void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) {
877 if (CanPasteAndGo(text)) 873 if (CanPasteAndGo(text))
878 model_->PasteAndGo(); 874 model_->PasteAndGo();
879 } 875 }
880 876
881 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( 877 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing(
882 const views::KeyEvent& e) { 878 const views::KeyEvent& e) {
883 int c = e.GetCharacter(); 879 int c = e.GetCharacter();
884 // We don't process ALT + numpad digit as accelerators, they are used for 880 // We don't process ALT + numpad digit as accelerators, they are used for
885 // entering special characters. We do translate alt-home. 881 // entering special characters. We do translate alt-home.
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, 2375 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO,
2371 IDS_PASTE_AND_GO); 2376 IDS_PASTE_AND_GO);
2372 context_menu_contents_->AddSeparator(); 2377 context_menu_contents_->AddSeparator();
2373 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); 2378 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL);
2374 context_menu_contents_->AddSeparator(); 2379 context_menu_contents_->AddSeparator();
2375 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, 2380 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES,
2376 IDS_EDIT_SEARCH_ENGINES); 2381 IDS_EDIT_SEARCH_ENGINES);
2377 } 2382 }
2378 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); 2383 context_menu_.reset(new views::Menu2(context_menu_contents_.get()));
2379 } 2384 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_win.h ('k') | chrome/browser/views/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698