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" |
11 #include "app/l10n_util_win.h" | 11 #include "app/l10n_util_win.h" |
12 #include "app/os_exchange_data.h" | 12 #include "app/os_exchange_data.h" |
13 #include "app/win_util.h" | 13 #include "app/win_util.h" |
14 #include "base/base_drag_source.h" | 14 #include "base/base_drag_source.h" |
15 #include "base/base_drop_target.h" | 15 #include "base/base_drop_target.h" |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/clipboard.h" | 17 #include "base/clipboard.h" |
18 #include "base/iat_patch.h" | 18 #include "base/iat_patch.h" |
19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
20 #include "base/ref_counted.h" | 20 #include "base/ref_counted.h" |
21 #include "base/scoped_clipboard_writer.h" | 21 #include "base/scoped_clipboard_writer.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
23 #include "chrome/app/chrome_dll_resource.h" | 23 #include "chrome/app/chrome_dll_resource.h" |
24 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" | 24 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" |
25 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 25 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
26 #include "chrome/browser/autocomplete/autocomplete_popup_view_win.h" | 26 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
27 #include "chrome/browser/autocomplete/keyword_provider.h" | 27 #include "chrome/browser/autocomplete/keyword_provider.h" |
28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
29 #include "chrome/browser/command_updater.h" | 29 #include "chrome/browser/command_updater.h" |
30 #include "chrome/browser/metrics/user_metrics.h" | 30 #include "chrome/browser/metrics/user_metrics.h" |
31 #include "chrome/browser/net/url_fixer_upper.h" | 31 #include "chrome/browser/net/url_fixer_upper.h" |
32 #include "chrome/browser/profile.h" | 32 #include "chrome/browser/profile.h" |
33 #include "chrome/browser/search_engines/template_url.h" | 33 #include "chrome/browser/search_engines/template_url.h" |
34 #include "chrome/browser/search_engines/template_url_model.h" | 34 #include "chrome/browser/search_engines/template_url_model.h" |
35 #include "chrome/browser/tab_contents/tab_contents.h" | 35 #include "chrome/browser/tab_contents/tab_contents.h" |
36 #include "chrome/browser/views/location_bar_view.h" | 36 #include "chrome/browser/views/location_bar_view.h" |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 867 |
868 const bool something_changed = model_->OnAfterPossibleChange(new_text, | 868 const bool something_changed = model_->OnAfterPossibleChange(new_text, |
869 selection_differs, text_differs, just_deleted_text, at_end_of_edit); | 869 selection_differs, text_differs, just_deleted_text, at_end_of_edit); |
870 | 870 |
871 if (something_changed && text_differs) | 871 if (something_changed && text_differs) |
872 TextChanged(); | 872 TextChanged(); |
873 | 873 |
874 return something_changed; | 874 return something_changed; |
875 } | 875 } |
876 | 876 |
| 877 gfx::NativeView AutocompleteEditViewWin::GetNativeView() const { |
| 878 return m_hWnd; |
| 879 } |
| 880 |
877 void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { | 881 void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) { |
878 if (CanPasteAndGo(text)) | 882 if (CanPasteAndGo(text)) |
879 model_->PasteAndGo(); | 883 model_->PasteAndGo(); |
880 } | 884 } |
881 | 885 |
882 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( | 886 bool AutocompleteEditViewWin::SkipDefaultKeyEventProcessing( |
883 const views::KeyEvent& e) { | 887 const views::KeyEvent& e) { |
884 int c = e.GetCharacter(); | 888 int c = e.GetCharacter(); |
885 // We don't process ALT + numpad digit as accelerators, they are used for | 889 // We don't process ALT + numpad digit as accelerators, they are used for |
886 // entering special characters. We do translate alt-home. | 890 // entering special characters. We do translate alt-home. |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, | 2367 context_menu_contents_->AddItemWithStringId(IDS_PASTE_AND_GO, |
2364 IDS_PASTE_AND_GO); | 2368 IDS_PASTE_AND_GO); |
2365 context_menu_contents_->AddSeparator(); | 2369 context_menu_contents_->AddSeparator(); |
2366 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); | 2370 context_menu_contents_->AddItemWithStringId(IDS_SELECT_ALL, IDS_SELECT_ALL); |
2367 context_menu_contents_->AddSeparator(); | 2371 context_menu_contents_->AddSeparator(); |
2368 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, | 2372 context_menu_contents_->AddItemWithStringId(IDS_EDIT_SEARCH_ENGINES, |
2369 IDS_EDIT_SEARCH_ENGINES); | 2373 IDS_EDIT_SEARCH_ENGINES); |
2370 } | 2374 } |
2371 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); | 2375 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
2372 } | 2376 } |
OLD | NEW |