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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "components/omnibox/browser/omnibox_edit_controller.h" | 27 #include "components/omnibox/browser/omnibox_edit_controller.h" |
28 #include "components/omnibox/browser/omnibox_edit_model.h" | 28 #include "components/omnibox/browser/omnibox_edit_model.h" |
29 #include "components/omnibox/browser/omnibox_field_trial.h" | 29 #include "components/omnibox/browser/omnibox_field_trial.h" |
30 #include "components/omnibox/browser/omnibox_popup_model.h" | 30 #include "components/omnibox/browser/omnibox_popup_model.h" |
31 #include "components/search/search.h" | 31 #include "components/search/search.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.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/window.h" |
37 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 38 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
38 #include "ui/base/dragdrop/drag_drop_types.h" | 39 #include "ui/base/dragdrop/drag_drop_types.h" |
39 #include "ui/base/dragdrop/os_exchange_data.h" | 40 #include "ui/base/dragdrop/os_exchange_data.h" |
40 #include "ui/base/ime/input_method.h" | 41 #include "ui/base/ime/input_method.h" |
41 #include "ui/base/ime/text_input_client.h" | 42 #include "ui/base/ime/text_input_client.h" |
42 #include "ui/base/ime/text_input_type.h" | 43 #include "ui/base/ime/text_input_type.h" |
43 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
44 #include "ui/base/models/simple_menu_model.h" | 45 #include "ui/base/models/simple_menu_model.h" |
45 #include "ui/compositor/layer.h" | 46 #include "ui/compositor/layer.h" |
46 #include "ui/events/event.h" | 47 #include "ui/events/event.h" |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 if (popup_window_mode_) { | 846 if (popup_window_mode_) { |
846 state->AddStateFlag(ui::AX_STATE_READ_ONLY); | 847 state->AddStateFlag(ui::AX_STATE_READ_ONLY); |
847 } else { | 848 } else { |
848 state->set_value_callback = | 849 state->set_value_callback = |
849 base::Bind(&OmniboxViewViews::AccessibilitySetValue, | 850 base::Bind(&OmniboxViewViews::AccessibilitySetValue, |
850 weak_ptr_factory_.GetWeakPtr()); | 851 weak_ptr_factory_.GetWeakPtr()); |
851 } | 852 } |
852 } | 853 } |
853 | 854 |
854 void OmniboxViewViews::OnFocus() { | 855 void OmniboxViewViews::OnFocus() { |
| 856 GetWidget()->GetNativeWindow()->SetName("OmniboxWindow"); |
855 views::Textfield::OnFocus(); | 857 views::Textfield::OnFocus(); |
| 858 GetWidget()->GetNativeWindow()->Focus(); |
856 // TODO(oshima): Get control key state. | 859 // TODO(oshima): Get control key state. |
857 model()->OnSetFocus(false); | 860 model()->OnSetFocus(false); |
858 // Don't call controller()->OnSetFocus, this view has already acquired focus. | 861 // Don't call controller()->OnSetFocus, this view has already acquired focus. |
859 | 862 |
860 // Restore the selection we saved in OnBlur() if it's still valid. | 863 // Restore the selection we saved in OnBlur() if it's still valid. |
861 if (saved_selection_for_focus_change_.IsValid()) { | 864 if (saved_selection_for_focus_change_.IsValid()) { |
862 SelectRange(saved_selection_for_focus_change_); | 865 SelectRange(saved_selection_for_focus_change_); |
863 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); | 866 saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); |
864 } | 867 } |
865 } | 868 } |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 menu_contents->InsertItemWithStringIdAt( | 1073 menu_contents->InsertItemWithStringIdAt( |
1071 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1074 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1072 } | 1075 } |
1073 | 1076 |
1074 // Minor note: We use IDC_ for command id here while the underlying textfield | 1077 // Minor note: We use IDC_ for command id here while the underlying textfield |
1075 // is using IDS_ for all its command ids. This is because views cannot depend | 1078 // is using IDS_ for all its command ids. This is because views cannot depend |
1076 // on IDC_ for now. | 1079 // on IDC_ for now. |
1077 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1080 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1078 IDS_EDIT_SEARCH_ENGINES); | 1081 IDS_EDIT_SEARCH_ENGINES); |
1079 } | 1082 } |
OLD | NEW |