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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 1177503003: Remove the 2-level input method system & InputMethodBridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits. Created 5 years, 5 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
OLDNEW
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
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 #endif 180 #endif
181 } 181 }
182 182
183 void OmniboxViewViews::SaveStateToTab(content::WebContents* tab) { 183 void OmniboxViewViews::SaveStateToTab(content::WebContents* tab) {
184 DCHECK(tab); 184 DCHECK(tab);
185 185
186 // We don't want to keep the IME status, so force quit the current 186 // We don't want to keep the IME status, so force quit the current
187 // session here. It may affect the selection status, so order is 187 // session here. It may affect the selection status, so order is
188 // also important. 188 // also important.
189 if (IsIMEComposing()) { 189 if (IsIMEComposing()) {
190 GetTextInputClient()->ConfirmCompositionText(); 190 ConfirmCompositionText();
191 GetInputMethod()->CancelComposition(this); 191 GetInputMethod()->CancelComposition(this);
192 } 192 }
193 193
194 // NOTE: GetStateForTabSwitch() may affect GetSelectedRange(), so order is 194 // NOTE: GetStateForTabSwitch() may affect GetSelectedRange(), so order is
195 // important. 195 // important.
196 OmniboxEditModel::State state = model()->GetStateForTabSwitch(); 196 OmniboxEditModel::State state = model()->GetStateForTabSwitch();
197 tab->SetUserData(OmniboxState::kKey, new OmniboxState( 197 tab->SetUserData(OmniboxState::kKey, new OmniboxState(
198 state, GetSelectedRange(), saved_selection_for_focus_change_)); 198 state, GetSelectedRange(), saved_selection_for_focus_change_));
199 } 199 }
200 200
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 } 571 }
572 572
573 int OmniboxViewViews::GetWidth() const { 573 int OmniboxViewViews::GetWidth() const {
574 return location_bar_view_ ? location_bar_view_->width() : 0; 574 return location_bar_view_ ? location_bar_view_->width() : 0;
575 } 575 }
576 576
577 bool OmniboxViewViews::IsImeShowingPopup() const { 577 bool OmniboxViewViews::IsImeShowingPopup() const {
578 #if defined(OS_CHROMEOS) 578 #if defined(OS_CHROMEOS)
579 return ime_candidate_window_open_; 579 return ime_candidate_window_open_;
580 #else 580 #else
581 const views::InputMethod* input_method = this->GetInputMethod(); 581 return GetInputMethod() ? GetInputMethod()->IsCandidatePopupOpen() : false;
582 return input_method && input_method->IsCandidatePopupOpen();
583 #endif 582 #endif
584 } 583 }
585 584
586 void OmniboxViewViews::ShowImeIfNeeded() { 585 void OmniboxViewViews::ShowImeIfNeeded() {
587 GetInputMethod()->ShowImeIfNeeded(); 586 GetInputMethod()->ShowImeIfNeeded();
588 } 587 }
589 588
590 void OmniboxViewViews::OnMatchOpened(const AutocompleteMatch& match, 589 void OmniboxViewViews::OnMatchOpened(const AutocompleteMatch& match,
591 content::WebContents* web_contents) { 590 content::WebContents* web_contents) {
592 extensions::MaybeShowExtensionControlledSearchNotification( 591 extensions::MaybeShowExtensionControlledSearchNotification(
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 menu_contents->InsertItemWithStringIdAt( 1061 menu_contents->InsertItemWithStringIdAt(
1063 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL); 1062 select_all_position + 1, IDS_SHOW_URL, IDS_SHOW_URL);
1064 } 1063 }
1065 1064
1066 // Minor note: We use IDC_ for command id here while the underlying textfield 1065 // Minor note: We use IDC_ for command id here while the underlying textfield
1067 // is using IDS_ for all its command ids. This is because views cannot depend 1066 // is using IDS_ for all its command ids. This is because views cannot depend
1068 // on IDC_ for now. 1067 // on IDC_ for now.
1069 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES, 1068 menu_contents->AddItemWithStringId(IDC_EDIT_SEARCH_ENGINES,
1070 IDS_EDIT_SEARCH_ENGINES); 1069 IDS_EDIT_SEARCH_ENGINES);
1071 } 1070 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/find_bar_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698