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 17 matching lines...) Expand all Loading... |
28 #include "components/omnibox/autocomplete_match.h" | 28 #include "components/omnibox/autocomplete_match.h" |
29 #include "components/omnibox/omnibox_field_trial.h" | 29 #include "components/omnibox/omnibox_field_trial.h" |
30 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
31 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
32 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
33 #include "third_party/skia/include/core/SkColor.h" | 33 #include "third_party/skia/include/core/SkColor.h" |
34 #include "ui/accessibility/ax_view_state.h" | 34 #include "ui/accessibility/ax_view_state.h" |
35 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 35 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
36 #include "ui/base/dragdrop/drag_drop_types.h" | 36 #include "ui/base/dragdrop/drag_drop_types.h" |
37 #include "ui/base/dragdrop/os_exchange_data.h" | 37 #include "ui/base/dragdrop/os_exchange_data.h" |
| 38 #include "ui/base/ime/input_method.h" |
38 #include "ui/base/ime/text_input_client.h" | 39 #include "ui/base/ime/text_input_client.h" |
39 #include "ui/base/ime/text_input_type.h" | 40 #include "ui/base/ime/text_input_type.h" |
40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/base/models/simple_menu_model.h" | 42 #include "ui/base/models/simple_menu_model.h" |
42 #include "ui/compositor/layer.h" | 43 #include "ui/compositor/layer.h" |
43 #include "ui/events/event.h" | 44 #include "ui/events/event.h" |
44 #include "ui/gfx/canvas.h" | 45 #include "ui/gfx/canvas.h" |
45 #include "ui/gfx/font_list.h" | 46 #include "ui/gfx/font_list.h" |
46 #include "ui/gfx/selection_model.h" | 47 #include "ui/gfx/selection_model.h" |
47 #include "ui/strings/grit/ui_strings.h" | 48 #include "ui/strings/grit/ui_strings.h" |
48 #include "ui/views/border.h" | 49 #include "ui/views/border.h" |
49 #include "ui/views/button_drag_utils.h" | 50 #include "ui/views/button_drag_utils.h" |
50 #include "ui/views/controls/textfield/textfield.h" | 51 #include "ui/views/controls/textfield/textfield.h" |
51 #include "ui/views/ime/input_method.h" | |
52 #include "ui/views/layout/fill_layout.h" | 52 #include "ui/views/layout/fill_layout.h" |
53 #include "ui/views/widget/widget.h" | 53 #include "ui/views/widget/widget.h" |
54 #include "url/gurl.h" | 54 #include "url/gurl.h" |
55 | 55 |
56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
57 #include "chrome/browser/browser_process.h" | 57 #include "chrome/browser/browser_process.h" |
58 #endif | 58 #endif |
59 | 59 |
60 using bookmarks::BookmarkNodeData; | 60 using bookmarks::BookmarkNodeData; |
61 | 61 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 } | 572 } |
573 | 573 |
574 int OmniboxViewViews::GetWidth() const { | 574 int OmniboxViewViews::GetWidth() const { |
575 return location_bar_view_ ? location_bar_view_->width() : 0; | 575 return location_bar_view_ ? location_bar_view_->width() : 0; |
576 } | 576 } |
577 | 577 |
578 bool OmniboxViewViews::IsImeShowingPopup() const { | 578 bool OmniboxViewViews::IsImeShowingPopup() const { |
579 #if defined(OS_CHROMEOS) | 579 #if defined(OS_CHROMEOS) |
580 return ime_candidate_window_open_; | 580 return ime_candidate_window_open_; |
581 #else | 581 #else |
582 const views::InputMethod* input_method = this->GetInputMethod(); | 582 return GetInputMethod() ? GetInputMethod()->IsCandidatePopupOpen() : false; |
583 return input_method && input_method->IsCandidatePopupOpen(); | |
584 #endif | 583 #endif |
585 } | 584 } |
586 | 585 |
587 void OmniboxViewViews::ShowImeIfNeeded() { | 586 void OmniboxViewViews::ShowImeIfNeeded() { |
588 GetInputMethod()->ShowImeIfNeeded(); | 587 GetInputMethod()->ShowImeIfNeeded(); |
589 } | 588 } |
590 | 589 |
591 void OmniboxViewViews::OnMatchOpened(const AutocompleteMatch& match, | 590 void OmniboxViewViews::OnMatchOpened(const AutocompleteMatch& match, |
592 content::WebContents* web_contents) { | 591 content::WebContents* web_contents) { |
593 extensions::MaybeShowExtensionControlledSearchNotification( | 592 extensions::MaybeShowExtensionControlledSearchNotification( |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 menu_contents->InsertItemWithStringIdAt( | 1054 menu_contents->InsertItemWithStringIdAt( |
1056 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); | 1055 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); |
1057 } | 1056 } |
1058 | 1057 |
1059 // Minor note: We use IDC_ for command id here while the underlying textfield | 1058 // Minor note: We use IDC_ for command id here while the underlying textfield |
1060 // is using IDS_ for all its command ids. This is because views cannot depend | 1059 // is using IDS_ for all its command ids. This is because views cannot depend |
1061 // on IDC_ for now. | 1060 // on IDC_ for now. |
1062 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, | 1061 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, |
1063 IDS_EDIT_SEARCH_ENGINES); | 1062 IDS_EDIT_SEARCH_ENGINES); |
1064 } | 1063 } |
OLD | NEW |