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

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

Issue 9350005: Call CancelComposition() in SaveStateToTab(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/property_bag.h" 7 #include "base/property_bag.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 20 matching lines...) Expand all
31 #include "ui/base/ime/text_input_client.h" 31 #include "ui/base/ime/text_input_client.h"
32 #include "ui/base/ime/text_input_type.h" 32 #include "ui/base/ime/text_input_type.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/models/simple_menu_model.h" 34 #include "ui/base/models/simple_menu_model.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/font.h" 36 #include "ui/gfx/font.h"
37 #include "ui/gfx/render_text.h" 37 #include "ui/gfx/render_text.h"
38 #include "ui/views/border.h" 38 #include "ui/views/border.h"
39 #include "ui/views/controls/textfield/textfield.h" 39 #include "ui/views/controls/textfield/textfield.h"
40 #include "ui/views/events/event.h" 40 #include "ui/views/events/event.h"
41 #include "ui/views/ime/input_method.h"
41 #include "ui/views/layout/fill_layout.h" 42 #include "ui/views/layout/fill_layout.h"
42 #include "ui/views/views_delegate.h" 43 #include "ui/views/views_delegate.h"
43 44
44 #if defined(OS_WIN) 45 #if defined(OS_WIN)
45 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" 46 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
46 #endif 47 #endif
47 48
48 using content::WebContents; 49 using content::WebContents;
49 50
50 namespace { 51 namespace {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 const AutocompleteEditModel* OmniboxViewViews::model() const { 370 const AutocompleteEditModel* OmniboxViewViews::model() const {
370 return model_.get(); 371 return model_.get();
371 } 372 }
372 373
373 void OmniboxViewViews::SaveStateToTab(WebContents* tab) { 374 void OmniboxViewViews::SaveStateToTab(WebContents* tab) {
374 DCHECK(tab); 375 DCHECK(tab);
375 376
376 // We don't want to keep the IME status, so force quit the current 377 // We don't want to keep the IME status, so force quit the current
377 // session here. It may affect the selection status, so order is 378 // session here. It may affect the selection status, so order is
378 // also important. 379 // also important.
379 // This actually doesn't notify any events to the input method, but 380 if (textfield_->IsIMEComposing()) {
380 // further call of SetText() will notify the current status, so
381 // that's fine.
382 // TODO(mukai): Add a method to InputMethod class to deal with such
383 // situation. http://crbug.com/111578
384 if (textfield_->IsIMEComposing())
385 textfield_->GetTextInputClient()->ConfirmCompositionText(); 381 textfield_->GetTextInputClient()->ConfirmCompositionText();
382 textfield_->GetInputMethod()->CancelComposition(textfield_);
383 }
386 384
387 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important. 385 // NOTE: GetStateForTabSwitch may affect GetSelection, so order is important.
388 AutocompleteEditModel::State model_state = model_->GetStateForTabSwitch(); 386 AutocompleteEditModel::State model_state = model_->GetStateForTabSwitch();
389 gfx::SelectionModel selection; 387 gfx::SelectionModel selection;
390 textfield_->GetSelectionModel(&selection); 388 textfield_->GetSelectionModel(&selection);
391 GetStateAccessor()->SetProperty( 389 GetStateAccessor()->SetProperty(
392 tab->GetPropertyBag(), 390 tab->GetPropertyBag(),
393 AutocompleteEditState(model_state, ViewState(selection))); 391 AutocompleteEditState(model_state, ViewState(selection)));
394 } 392 }
395 393
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller, 851 OmniboxViewViews* omnibox_view = new OmniboxViewViews(controller,
854 toolbar_model, 852 toolbar_model,
855 profile, 853 profile,
856 command_updater, 854 command_updater,
857 popup_window_mode, 855 popup_window_mode,
858 location_bar); 856 location_bar);
859 omnibox_view->Init(); 857 omnibox_view->Init();
860 return omnibox_view; 858 return omnibox_view;
861 } 859 }
862 #endif 860 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698