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

Side by Side Diff: ui/base/win/tsf_bridge.cc

Issue 10912171: Introduce RenderWidgetHostViewWinTest for Tsf handling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments Created 8 years, 3 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 <msctf.h> 5 #include <msctf.h>
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 VLOG(1) << "Do not use TsfBridge without UI thread."; 320 VLOG(1) << "Do not use TsfBridge without UI thread.";
321 return false; 321 return false;
322 } 322 }
323 tls_tsf_bridge.Initialize(FreeTlsTsfBridgeDelegate); 323 tls_tsf_bridge.Initialize(FreeTlsTsfBridgeDelegate);
324 TsfBridgeDelegate* delegate = new TsfBridgeDelegate(); 324 TsfBridgeDelegate* delegate = new TsfBridgeDelegate();
325 tls_tsf_bridge.Set(delegate); 325 tls_tsf_bridge.Set(delegate);
326 return delegate->Initialize(); 326 return delegate->Initialize();
327 } 327 }
328 328
329 // static 329 // static
330 TsfBridge* TsfBridge::ReplaceForTesting(TsfBridge* bridge) {
331 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) {
332 VLOG(1) << "Do not use TsfBridge without UI thread.";
333 return NULL;
334 }
335 TsfBridge* old_bridge = TsfBridge::GetInstance();
336 tls_tsf_bridge.Set(bridge);
337 return old_bridge;
338 }
339
340 // static
330 TsfBridge* TsfBridge::GetInstance() { 341 TsfBridge* TsfBridge::GetInstance() {
331 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) { 342 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) {
332 VLOG(1) << "Do not use TsfBridge without UI thread."; 343 VLOG(1) << "Do not use TsfBridge without UI thread.";
333 return NULL; 344 return NULL;
334 } 345 }
335 TsfBridgeDelegate* delegate = 346 TsfBridgeDelegate* delegate =
336 static_cast<TsfBridgeDelegate*>(tls_tsf_bridge.Get()); 347 static_cast<TsfBridgeDelegate*>(tls_tsf_bridge.Get());
337 DCHECK(delegate) << "Do no call GetInstance before TsfBridge::Initialize."; 348 DCHECK(delegate) << "Do no call GetInstance before TsfBridge::Initialize.";
338 return delegate; 349 return delegate;
339 } 350 }
340 351
341 } // namespace ui 352 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698