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

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: rebase Created 8 years, 2 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 | « ui/base/win/tsf_bridge.h ('k') | ui/ui_unittests.gypi » ('j') | 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 <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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 VLOG(1) << "Do not use TsfBridge without UI thread."; 456 VLOG(1) << "Do not use TsfBridge without UI thread.";
457 return false; 457 return false;
458 } 458 }
459 tls_tsf_bridge.Initialize(FreeTlsTsfBridgeDelegate); 459 tls_tsf_bridge.Initialize(FreeTlsTsfBridgeDelegate);
460 TsfBridgeDelegate* delegate = new TsfBridgeDelegate(); 460 TsfBridgeDelegate* delegate = new TsfBridgeDelegate();
461 tls_tsf_bridge.Set(delegate); 461 tls_tsf_bridge.Set(delegate);
462 return delegate->Initialize(); 462 return delegate->Initialize();
463 } 463 }
464 464
465 // static 465 // static
466 TsfBridge* TsfBridge::ReplaceForTesting(TsfBridge* bridge) {
467 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) {
468 VLOG(1) << "Do not use TsfBridge without UI thread.";
469 return NULL;
470 }
471 TsfBridge* old_bridge = TsfBridge::GetInstance();
472 tls_tsf_bridge.Set(bridge);
473 return old_bridge;
474 }
475
476 // static
466 TsfBridge* TsfBridge::GetInstance() { 477 TsfBridge* TsfBridge::GetInstance() {
467 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) { 478 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) {
468 VLOG(1) << "Do not use TsfBridge without UI thread."; 479 VLOG(1) << "Do not use TsfBridge without UI thread.";
469 return NULL; 480 return NULL;
470 } 481 }
471 TsfBridgeDelegate* delegate = 482 TsfBridgeDelegate* delegate =
472 static_cast<TsfBridgeDelegate*>(tls_tsf_bridge.Get()); 483 static_cast<TsfBridgeDelegate*>(tls_tsf_bridge.Get());
473 DCHECK(delegate) << "Do no call GetInstance before TsfBridge::Initialize."; 484 DCHECK(delegate) << "Do no call GetInstance before TsfBridge::Initialize.";
474 return delegate; 485 return delegate;
475 } 486 }
476 487
477 } // namespace ui 488 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/win/tsf_bridge.h ('k') | ui/ui_unittests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698