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

Side by Side Diff: ui/base/ime/input_method_factory.cc

Issue 2259753003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/aura/window.cc ('k') | ui/base/ime/linux/fake_input_method_context_factory.cc » ('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 "ui/base/ime/input_method_factory.h" 5 #include "ui/base/ime/input_method_factory.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/base/ime/mock_input_method.h" 9 #include "ui/base/ime/mock_input_method.h"
10 10
(...skipping 30 matching lines...) Expand all
41 if (!g_create_input_method_called) 41 if (!g_create_input_method_called)
42 g_create_input_method_called = true; 42 g_create_input_method_called = true;
43 43
44 if (g_input_method_for_testing) { 44 if (g_input_method_for_testing) {
45 ui::InputMethod* ret = g_input_method_for_testing; 45 ui::InputMethod* ret = g_input_method_for_testing;
46 g_input_method_for_testing = nullptr; 46 g_input_method_for_testing = nullptr;
47 return base::WrapUnique(ret); 47 return base::WrapUnique(ret);
48 } 48 }
49 49
50 if (g_input_method_set_for_testing) 50 if (g_input_method_set_for_testing)
51 return base::WrapUnique(new MockInputMethod(delegate)); 51 return base::MakeUnique<MockInputMethod>(delegate);
52 52
53 #if defined(OS_CHROMEOS) 53 #if defined(OS_CHROMEOS)
54 return base::WrapUnique(new InputMethodChromeOS(delegate)); 54 return base::MakeUnique<InputMethodChromeOS>(delegate);
55 #elif defined(OS_WIN) 55 #elif defined(OS_WIN)
56 return base::WrapUnique(new InputMethodWin(delegate, widget)); 56 return base::MakeUnique<InputMethodWin>(delegate, widget);
57 #elif defined(OS_MACOSX) 57 #elif defined(OS_MACOSX)
58 return base::WrapUnique(new InputMethodMac(delegate)); 58 return base::MakeUnique<InputMethodMac>(delegate);
59 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \ 59 #elif defined(USE_AURA) && defined(OS_LINUX) && defined(USE_X11) && \
60 !defined(OS_CHROMEOS) 60 !defined(OS_CHROMEOS)
61 return base::WrapUnique(new InputMethodAuraLinux(delegate)); 61 return base::MakeUnique<InputMethodAuraLinux>(delegate);
62 #elif defined(OS_ANDROID) 62 #elif defined(OS_ANDROID)
63 return base::WrapUnique(new InputMethodAndroid(delegate)); 63 return base::MakeUnique<InputMethodAndroid>(delegate);
64 #else 64 #else
65 return base::WrapUnique(new InputMethodMinimal(delegate)); 65 return base::MakeUnique<InputMethodMinimal>(delegate);
66 #endif 66 #endif
67 } 67 }
68 68
69 void SetUpInputMethodFactoryForTesting() { 69 void SetUpInputMethodFactoryForTesting() {
70 if (g_input_method_set_for_testing) 70 if (g_input_method_set_for_testing)
71 return; 71 return;
72 72
73 CHECK(!g_create_input_method_called) 73 CHECK(!g_create_input_method_called)
74 << "ui::SetUpInputMethodFactoryForTesting was called after use of " 74 << "ui::SetUpInputMethodFactoryForTesting was called after use of "
75 << "ui::CreateInputMethod. You must call " 75 << "ui::CreateInputMethod. You must call "
76 << "ui::SetUpInputMethodFactoryForTesting earlier."; 76 << "ui::SetUpInputMethodFactoryForTesting earlier.";
77 77
78 g_input_method_set_for_testing = true; 78 g_input_method_set_for_testing = true;
79 } 79 }
80 80
81 void SetUpInputMethodForTesting(InputMethod* input_method) { 81 void SetUpInputMethodForTesting(InputMethod* input_method) {
82 g_input_method_for_testing = input_method; 82 g_input_method_for_testing = input_method;
83 } 83 }
84 84
85 } // namespace ui 85 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/base/ime/linux/fake_input_method_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698