Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| index 299c08f6f883f7d4c3bca327ef8558c49235f828..71ca5dc46fa8e2a70953a283e1f9d202addeed3e 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| @@ -480,7 +480,10 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller, |
| chrome::search::IsInstantExtendedAPIEnabled(parent_view_->profile()), |
| ToolbarModel::NONE, LocationBarView::BACKGROUND))), |
| security_level_(ToolbarModel::NONE), |
| - text_object_model_(NULL) { |
| + text_object_model_(NULL), |
| + ALLOW_THIS_IN_INITIALIZER_LIST( |
| + tsf_event_router_(base::win::IsTsfAwareRequired() ? |
| + new ui::TsfEventRouter(this) : NULL)) { |
| if (!loaded_library_module_) |
| loaded_library_module_ = LoadLibrary(kRichEditDLLName); |
| @@ -541,9 +544,6 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller, |
| // the edit control will invoke RevokeDragDrop when it's being destroyed, so |
| // we don't have to do so. |
| scoped_refptr<EditDropTarget> drop_target(new EditDropTarget(this)); |
| - |
| - if (base::win::IsTsfAwareRequired()) |
| - tsf_event_router_ = ui::TsfEventRouter::Create(); |
| } |
| } |
| @@ -556,7 +556,7 @@ OmniboxViewWin::~OmniboxViewWin() { |
| text_object_model_->Release(); |
| if (tsf_event_router_) |
| - tsf_event_router_->SetManager(NULL, NULL); |
| + tsf_event_router_->SetManager(NULL); |
|
Peter Kasting
2012/10/26 01:53:47
Is this necessary? Can't we just let the TsfEvent
Seigo Nonaka
2012/10/26 02:23:10
Yes! done.
On 2012/10/26 01:53:47, Peter Kasting
|
| // We balance our reference count and unpatch when the last instance has |
| // been destroyed. This prevents us from relying on the AtExit or static |
| @@ -1626,7 +1626,7 @@ void OmniboxViewWin::OnKillFocus(HWND focus_wnd) { |
| PlaceCaretAt(0); |
| if (tsf_event_router_) |
| - tsf_event_router_->SetManager(NULL, NULL); |
| + tsf_event_router_->SetManager(NULL); |
| } |
| void OmniboxViewWin::OnLButtonDblClk(UINT keys, const CPoint& point) { |
| @@ -1961,8 +1961,7 @@ void OmniboxViewWin::OnSetFocus(HWND focus_wnd) { |
| // Document manager created by RichEdit can be obtained only after |
| // WM_SETFOCUS event is handled. |
| tsf_event_router_->SetManager( |
| - ui::TsfBridge::GetInstance()->GetThreadManager(), |
| - this); |
| + ui::TsfBridge::GetInstance()->GetThreadManager()); |
| SetMsgHandled(true); |
| } |
| } |