OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 15 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
16 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
17 #include "chrome/browser/search/search.h" | 17 #include "chrome/browser/search/search.h" |
18 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" | 18 #include "chrome/browser/ui/omnibox/omnibox_edit_controller.h" |
19 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 19 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
20 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 20 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
21 #include "chrome/browser/ui/view_ids.h" | 21 #include "chrome/browser/ui/view_ids.h" |
22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
23 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" | 23 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
24 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" | 24 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
25 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" | 25 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
| 26 #include "chrome/grit/generated_resources.h" |
26 #include "components/bookmarks/browser/bookmark_node_data.h" | 27 #include "components/bookmarks/browser/bookmark_node_data.h" |
27 #include "components/omnibox/autocomplete_input.h" | 28 #include "components/omnibox/autocomplete_input.h" |
28 #include "components/omnibox/autocomplete_match.h" | 29 #include "components/omnibox/autocomplete_match.h" |
29 #include "components/omnibox/omnibox_field_trial.h" | 30 #include "components/omnibox/omnibox_field_trial.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
31 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
32 #include "grit/app_locale_settings.h" | 33 #include "grit/app_locale_settings.h" |
33 #include "grit/generated_resources.h" | |
34 #include "net/base/escape.h" | 34 #include "net/base/escape.h" |
35 #include "third_party/skia/include/core/SkColor.h" | 35 #include "third_party/skia/include/core/SkColor.h" |
36 #include "ui/accessibility/ax_view_state.h" | 36 #include "ui/accessibility/ax_view_state.h" |
37 #include "ui/aura/client/focus_client.h" | 37 #include "ui/aura/client/focus_client.h" |
38 #include "ui/aura/window_event_dispatcher.h" | 38 #include "ui/aura/window_event_dispatcher.h" |
39 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 39 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
40 #include "ui/base/dragdrop/drag_drop_types.h" | 40 #include "ui/base/dragdrop/drag_drop_types.h" |
41 #include "ui/base/dragdrop/os_exchange_data.h" | 41 #include "ui/base/dragdrop/os_exchange_data.h" |
42 #include "ui/base/ime/text_input_client.h" | 42 #include "ui/base/ime/text_input_client.h" |
43 #include "ui/base/ime/text_input_type.h" | 43 #include "ui/base/ime/text_input_type.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 state->selection_start = entry_start; | 813 state->selection_start = entry_start; |
814 state->selection_end = entry_end; | 814 state->selection_end = entry_end; |
815 | 815 |
816 if (popup_window_mode_) { | 816 if (popup_window_mode_) { |
817 state->AddStateFlag(ui::AX_STATE_READ_ONLY); | 817 state->AddStateFlag(ui::AX_STATE_READ_ONLY); |
818 } else { | 818 } else { |
819 state->set_value_callback = | 819 state->set_value_callback = |
820 base::Bind(&OmniboxViewViews::AccessibilitySetValue, | 820 base::Bind(&OmniboxViewViews::AccessibilitySetValue, |
821 weak_ptr_factory_.GetWeakPtr()); | 821 weak_ptr_factory_.GetWeakPtr()); |
822 } | 822 } |
823 | |
824 } | 823 } |
825 | 824 |
826 void OmniboxViewViews::OnFocus() { | 825 void OmniboxViewViews::OnFocus() { |
827 views::Textfield::OnFocus(); | 826 views::Textfield::OnFocus(); |
828 // TODO(oshima): Get control key state. | 827 // TODO(oshima): Get control key state. |
829 model()->OnSetFocus(false); | 828 model()->OnSetFocus(false); |
830 // Don't call controller()->OnSetFocus, this view has already acquired focus. | 829 // Don't call controller()->OnSetFocus, this view has already acquired focus. |
831 | 830 |
832 // Restore the selection we saved in OnBlur() if it's still valid. | 831 // Restore the selection we saved in OnBlur() if it's still valid. |
833 if (saved_selection_for_focus_change_.IsValid()) { | 832 if (saved_selection_for_focus_change_.IsValid()) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 menu_contents->InsertItemWithStringIdAt( | 1039 menu_contents->InsertItemWithStringIdAt( |
1041 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1040 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1042 } | 1041 } |
1043 | 1042 |
1044 // Minor note: We use IDC_ for command id here while the underlying textfield | 1043 // Minor note: We use IDC_ for command id here while the underlying textfield |
1045 // is using IDS_ for all its command ids. This is because views cannot depend | 1044 // is using IDS_ for all its command ids. This is because views cannot depend |
1046 // on IDC_ for now. | 1045 // on IDC_ for now. |
1047 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1046 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1048 IDS_EDIT_SEARCH_ENGINES); | 1047 IDS_EDIT_SEARCH_ENGINES); |
1049 } | 1048 } |
OLD | NEW |