Codebase list mozc / 3319211
Merge commit 'upstream/1.2.855.102' Nobuhiro Iwamatsu 12 years ago
20 changed file(s) with 150 addition(s) and 219 deletion(s). Raw diff Collapse all Expand all
24402440 << "Can't get passwd entry for uid " << uid << ".";
24412441 CHECK_LT(0, strlen(pw.pw_dir))
24422442 << "Home directory for uid " << uid << " is not set.";
2443 #if defined(OS_CHROMEOS)
2444 dir = Util::JoinPath(pw.pw_dir, "user/.mozc");
2445 #else
24462443 dir = Util::JoinPath(pw.pw_dir, ".mozc");
2447 #endif // OS_CHROMEOS
24482444 #endif
24492445
24502446 Util::CreateDirectory(dir);
31163112 // http://b/2430094
31173113 // This is why we use VerifyVersionInfo here instead of GetVersion(Ex).
31183114
3119 if (IsWindowsX64() && !Util::IsVistaOrLater()) {
3120 // NT 5.x OSes are excluded from Mozc 64-bit support.
3121 return false; // not supported
3122 }
31233115 // You can find a table of version number for each version of Windows in
31243116 // the following page.
31253117 // http://msdn.microsoft.com/en-us/library/ms724833.aspx
31263118 {
31273119 // Windows 7 <= |OSVERSION|: supported
3128 OSVERSIONINFOEX osvi = { 0 };
3120 OSVERSIONINFOEX osvi = {};
31293121 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
31303122 osvi.dwMajorVersion = 6;
31313123 osvi.dwMinorVersion = 1;
31393131 }
31403132 {
31413133 // Windows Vista SP1 <= |OSVERSION| < Windows 7: supported
3142 OSVERSIONINFOEX osvi = { 0 };
3134 OSVERSIONINFOEX osvi = {};
31433135 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
31443136 osvi.dwMajorVersion = 6;
31453137 osvi.dwMinorVersion = 0;
31553147 }
31563148 }
31573149 {
3158 // Windows Server 2003 <= |OSVERSION| < Windows Vista SP1: not supported
3159 OSVERSIONINFOEX osvi = { 0 };
3150 // Windows Vista RTM <= |OSVERSION| < Windows Vista SP1: not supported
3151 OSVERSIONINFOEX osvi = {};
3152 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
3153 osvi.dwMajorVersion = 6;
3154 osvi.dwMinorVersion = 0;
3155 osvi.wServicePackMajor = 0;
3156 DWORDLONG conditional = 0;
3157 VER_SET_CONDITION(conditional, VER_MAJORVERSION, VER_GREATER_EQUAL);
3158 VER_SET_CONDITION(conditional, VER_MINORVERSION, VER_GREATER_EQUAL);
3159 VER_SET_CONDITION(conditional, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
3160 const DWORD typemask = VER_MAJORVERSION | VER_MINORVERSION |
3161 VER_SERVICEPACKMAJOR;
3162 if (::VerifyVersionInfo(&osvi, typemask, conditional) != 0) {
3163 return false; // not supported
3164 }
3165 }
3166 {
3167 // Windows XP x64/Server 2003 <= |OSVERSION| < Windows Vista RTM: supported
3168 // ---
3169 // Note: We do not oficially support these platforms but allows users to
3170 // install Mozc into them. See b/5182031 for the background information.
3171 OSVERSIONINFOEX osvi = {};
31603172 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
31613173 osvi.dwMajorVersion = 5;
31623174 osvi.dwMinorVersion = 2;
31653177 VER_SET_CONDITION(conditional, VER_MINORVERSION, VER_GREATER_EQUAL);
31663178 const DWORD typemask = VER_MAJORVERSION | VER_MINORVERSION;
31673179 if (::VerifyVersionInfo(&osvi, typemask, conditional) != 0) {
3168 return false; // not supported
3180 return true; // supported
31693181 }
31703182 }
31713183 {
3172 // Windows XP SP2 <= |OSVERSION| < Windows Server 2003: supported
3173 OSVERSIONINFOEX osvi = { 0 };
3184 // Windows XP SP2 <= |OSVERSION| < Windows XP x64/Server 2003: supported
3185 OSVERSIONINFOEX osvi = {};
31743186 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
31753187 osvi.dwMajorVersion = 5;
31763188 osvi.dwMinorVersion = 1;
20172017 "\xE3\x87\xB6\xE3\x87\xB7\xE3\x87\xB8\xE3\x87\xB9\xE3\x87\xBA"
20182018 "\xE3\x87\xBB\xE3\x87\xBC\xE3\x87\xBD\xE3\x87\xBE\xE3\x87\xBF",
20192019 Util::KATAKANA));
2020 // "𛀀" U+1B000: KATAKANA LETTER ARCHAIC E
2020 // "𛀀›€€" U+1B000: KATAKANA LETTER ARCHAIC E
20212021 EXPECT_TRUE(Util::IsScriptType("\xF0\x9B\x80\x80", Util::KATAKANA));
2022 // "𛀁" U+1B001: HIRAGANA LETTER ARCHAIC YE
2022 // "𛀁›€" U+1B001: HIRAGANA LETTER ARCHAIC YE
20232023 EXPECT_TRUE(Util::IsScriptType("\xF0\x9B\x80\x81", Util::HIRAGANA));
20242024
20252025 EXPECT_TRUE(Util::IsScriptType("012", Util::NUMBER));
21042104 "\xE3\x87\xB1\xE3\x87\xB2\xE3\x87\xB3\xE3\x87\xB4\xE3\x87\xB5"
21052105 "\xE3\x87\xB6\xE3\x87\xB7\xE3\x87\xB8\xE3\x87\xB9\xE3\x87\xBA"
21062106 "\xE3\x87\xBB\xE3\x87\xBC\xE3\x87\xBD\xE3\x87\xBE\xE3\x87\xBF"));
2107 // "𛀀" U+1B000 KATAKANA LETTER ARCHAIC E
2107 // "𛀀" U+1B000 KATAKANA LETTER ARCHAIC E
21082108 EXPECT_EQ(Util::KATAKANA, Util::GetScriptType("\xF0\x9B\x80\x80"));
2109 // "𛀁" U+1B001 HIRAGANA LETTER ARCHAIC YE
2109 // "𛀁" U+1B001 HIRAGANA LETTER ARCHAIC YE
21102110 EXPECT_EQ(Util::HIRAGANA, Util::GetScriptType("\xF0\x9B\x80\x81"));
21112111
21122112 // "!グーグル"
22202220 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xE9\xBE\xBB"));
22212221 // U+9FFF is not assigned yet but reserved for CJK Unified Ideographs.
22222222 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xE9\xBE\xFF"));
2223 // "𠮟咤" U+20B9F U+54A4
2223 // "𠮟咤" U+20B9F U+54A4
22242224 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xF0\xA0\xAE\x9F\xE5\x92\xA4"));
2225 // "ð ®·野" U+20BB7 U+91CE
2225 // "𠮷野" U+20BB7 U+91CE
22262226 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xF0\xA0\xAE\xB7\xE9\x87\x8E"));
2227 // "巽" U+2F884
2227 // "巽" U+2F884
22282228 EXPECT_EQ(Util::KANJI, Util::GetScriptType("\xF0\xAF\xA2\x84"));
22292229 }
22302230
536536
537537 PSECURITY_ATTRIBUTES security_attributes_ptr = NULL;
538538 SECURITY_ATTRIBUTES security_attributes = {};
539 if (!WinSandbox::MakeSecurityAttributes(&security_attributes)) {
539 if (WinSandbox::MakeSecurityAttributes(&security_attributes)) {
540540 security_attributes_ptr = &security_attributes;
541541 // Override the impersonation thread token's DACL to avoid http://b/1728895
542542 // On Windows Server, the objects created by a member of
362362 help='Specifies the DEPS file.')
363363 parser.add_option('--gyp_generator', dest='gyp_generator',
364364 help='Specifies the generator for GYP.')
365 parser.add_option('--onepass', '-1', dest='onepass', action='store_true',
366 default=False, help='Builds mozc in one pass. '
367 'Not recommended, intended to use only for Debug build.')
365 parser.add_option('--deprecated_onepass', '-1', dest='onepass',
366 action='store_true',
367 default=False,
368 help='Not supported. Builds mozc in one pass.')
368369 parser.add_option('--branding', dest='branding', default='Mozc')
369370 parser.add_option('--gypdir', dest='gypdir', default='third_party/gyp')
370371 parser.add_option('--noqt', action='store_true', dest='noqt', default=False)
build_tools/__init__.pyc less more
Binary diff not shown
build_tools/mozc_version.pyc less more
Binary diff not shown
5757 # We don't capture stdout and stderr from Popen. The output will just
5858 # be emitted to a terminal or console.
5959 print sys.argv
60 process = subprocess.Popen(sys.argv)
60 sys.exit(subprocess.call(sys.argv))
6161
6262 if __name__ == '__main__':
6363 main()
5656 #include "base/util.h"
5757
5858 namespace mozc {
59
6059 namespace {
60
61 #ifdef GOOGLE_JAPANESE_INPUT_BUILD
6162 #ifdef OS_WINDOWS
63
6264 const wchar_t kOmahaGUID[] = L"{DDCCD2A9-025E-4142-BCEB-F467B88CF830}";
6365 const wchar_t kOmahaUsageKey[] =
6466 L"Software\\Google\\Update\\ClientState\\"
217219 #endif // MACOSX
218220
219221
220 #ifdef OS_LINUX
221 class LinuxStatsConfigUtilImpl : public StatsConfigUtilInterface {
222 // TODO(toshiyuki): implement this
222 #endif // GOOGLE_JAPANESE_INPUT_BUILD
223
224 class NullStatsConfigUtilImpl : public StatsConfigUtilInterface {
223225 public:
224 LinuxStatsConfigUtilImpl();
225 virtual ~LinuxStatsConfigUtilImpl();
226 bool IsEnabled();
227 bool SetEnabled(bool val);
226 NullStatsConfigUtilImpl() {}
227 virtual ~NullStatsConfigUtilImpl() {}
228 bool IsEnabled() {
229 return false;
230 }
231 bool SetEnabled(bool val) {
232 return true;
233 }
228234 };
229235
230 LinuxStatsConfigUtilImpl::LinuxStatsConfigUtilImpl() {}
231
232 LinuxStatsConfigUtilImpl::~LinuxStatsConfigUtilImpl() {}
233
234 bool LinuxStatsConfigUtilImpl::IsEnabled() {
235 return false;
236 }
237
238 bool LinuxStatsConfigUtilImpl::SetEnabled(bool val) {
239 return true;
240 }
241 #endif // OS_LINUX
242
243236 StatsConfigUtilInterface *g_stats_config_util_handler = NULL;
244237
245238 // GetStatsConfigUtil and SetHandler are not thread safe.
246239
247 #ifdef OS_WINDOWS
240 #if !defined(GOOGLE_JAPANESE_INPUT_BUILD)
241 // For non-official build, use null implementation.
242 typedef NullStatsConfigUtilImpl DefaultConfigUtilImpl;
243 #elif defined(OS_WINDOWS)
248244 typedef WinStatsConfigUtilImpl DefaultConfigUtilImpl;
249245 #elif defined(OS_MACOSX)
250246 typedef MacStatsConfigUtilImpl DefaultConfigUtilImpl;
251247 #else
252 typedef LinuxStatsConfigUtilImpl DefaultConfigUtilImpl;
248 // Fall back mode. Use null implementation.
249 typedef NullStatsConfigUtilImpl DefaultConfigUtilImpl;
253250 #endif
254251
255252 StatsConfigUtilInterface &GetStatsConfigUtil() {
3939 #endif
4040
4141
42 #ifdef GOOGLE_JAPANESE_INPUT_BUILD
4243 #ifdef OS_WINDOWS
4344
4445 namespace {
503504 EXPECT_EQ(1, value);
504505 EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium));
505506
506 // Check if SetEnabled(true) merges kHKLM_ClientStateMedium.
507 test.ClearUsagestatsValue();
508 test.SetUsagestatsValue(kHKLM_ClientStateMedium, 1);
509 EXPECT_TRUE(StatsConfigUtil::SetEnabled(true));
510 EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState));
511 EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState));
512 test.GetUsagestatsValue(kHKLM_ClientState, &value);
513 EXPECT_EQ(1, value);
514 EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium));
515
516 test.ClearUsagestatsValue();
517 test.SetUsagestatsValue(kHKLM_ClientStateMedium, 0);
518 EXPECT_TRUE(StatsConfigUtil::SetEnabled(true));
519 EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState));
520 EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState));
521 test.GetUsagestatsValue(kHKLM_ClientState, &value);
522 EXPECT_EQ(1, value);
523 EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium));
524
525507 // Check if SetEnabled(false) works as expected.
526508 test.ClearUsagestatsValue();
527 EXPECT_TRUE(StatsConfigUtil::SetEnabled(false));
528 EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState));
529 EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState));
530 test.GetUsagestatsValue(kHKLM_ClientState, &value);
531 EXPECT_EQ(0, value);
532 EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium));
533
534 // Check if SetEnabled(false) works as expected.
535 test.ClearUsagestatsValue();
536 test.SetUsagestatsValue(kHKLM_ClientStateMedium, 1);
537 EXPECT_TRUE(StatsConfigUtil::SetEnabled(false));
538 EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState));
539 EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState));
540 test.GetUsagestatsValue(kHKLM_ClientState, &value);
541 EXPECT_EQ(0, value);
542 EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium));
543
544 test.ClearUsagestatsValue();
545 test.SetUsagestatsValue(kHKLM_ClientStateMedium, 0);
546509 EXPECT_TRUE(StatsConfigUtil::SetEnabled(false));
547510 EXPECT_FALSE(test.HasUsagestatsValue(kHKCU_ClientState));
548511 EXPECT_TRUE(test.HasUsagestatsValue(kHKLM_ClientState));
719682 }
720683 #endif // !CHANNEL_DEV
721684
722 TEST_F(StatsConfigUtilTestWin, IsEnabledForRunLevelLow) {
723 RegistryEmulator<__COUNTER__> test;
724
725 test.SetRunLevel(kRunLevelHigh);
726 // Enabling usagestats with proper style.
727 test.SetUsagestatsValue(kHKLM_ClientState, 1);
728 // Disable usagestats with wrong style.
729 test.SetUsagestatsValue(kHKCU_ClientState, 0);
730
731 test.SetRunLevel(kRunLevelLow);
732
733 #if defined(CHANNEL_DEV)
734 // In dev channel, IsEnabled always returns true regardless of the registry
735 // settings.
736 EXPECT_TRUE(StatsConfigUtil::IsEnabled());
737 #else
738 // In beta and stable channels, disabling entry with wrong style should be
739 // honored even if it is enabled in |kHKLM_ClientState|
740 EXPECT_FALSE(StatsConfigUtil::IsEnabled());
741 #endif
742
743 // If the runlevel is low, we cannot remove the entry under HKCU.
744 // The previous states should remain as it were.
745 EXPECT_FALSE(test.HasUsagestatsValue(kHKLM_ClientStateMedium));
746 EXPECT_TRUE(test.HasUsagestatsValue(kHKCU_ClientState));
747 DWORD value = 0;
748 test.GetUsagestatsValue(kHKCU_ClientState, &value);
749 EXPECT_EQ(0, value);
750 }
751685 } // namespace mozc
752686 #endif // OS_WINDOWS
753687
760694 EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled());
761695 }
762696 #endif // OS_LINUX
697
698 #else // !GOOGLE_JAPANESE_INPUT_BUILD
699 TEST(StatsConfigUtilTestNonOfficialBuild, DefaultValueTest) {
700 EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled());
701 }
702 #endif
1515 <layout>kr(kr104)</layout>
1616 <name>mozc-hangul</name>
1717 <longname>Mozc Hangul</longname>
18 <hotkeys>Shift+space,Hangul</hotkeys>
1918 </engine>
2019 </engines>
2120 </component>
00 MAJOR=1
11 MINOR=2
2 BUILD=831
2 BUILD=855
33 REVISION=102
4646 #include "rewriter/variants_rewriter.h"
4747 #include "rewriter/version_rewriter.h"
4848 #include "rewriter/zipcode_rewriter.h"
49 #if defined(OS_MACOSX) || defined(OS_WINDOWS)
50 // TODO(horo): Usage is available only in Mac and Windows now.
49 #if defined(OS_MACOSX) || defined(OS_WINDOWS) || defined(OS_CHROMEOS)
50 // TODO(horo): Usage is available only in Mac and Windows and ChromeOS now.
5151 #include "rewriter/usage_rewriter.h"
5252 #endif
5353 DEFINE_bool(use_history_rewriter, true, "Use history rewriter or not.");
8181 AddRewriter(new DateRewriter);
8282 AddRewriter(new FortuneRewriter);
8383 AddRewriter(new VersionRewriter);
84 #if defined(OS_MACOSX) || defined(OS_WINDOWS)
84 #if defined(OS_MACOSX) || defined(OS_WINDOWS) || defined(OS_CHROMEOS)
8585 // TODO(horo): Because infolist renderer window is implimented
86 // only in Mac and Windows, usage is available only
87 // in Mac and Winnows.
86 // only in Mac and Windows and ChromeOS,
87 // usage is available only in these OS.
8888 AddRewriter(new UsageRewriter);
89 #endif // defined(OS_MACOSX) || defined(OS_WINDOWS)
89 #endif // defined(OS_MACOSX) || defined(OS_WINDOWS) || defined(OS_CHROMEOS)
9090 }
9191
9292 RewriterInterface *g_rewriter = NULL;
7979 'calculator/calculator.gyp:calculator',
8080 'rewriter_base.gyp:gen_rewriter_files',
8181 ],
82 # TODO(horo): usage is available only in Mac and Win now.
82 # TODO(horo): usage is available only in Mac and Win and ChromeOS now.
8383 'conditions': [
84 ['OS=="mac" or OS=="win"', {
84 ['OS=="mac" or OS=="win" or chromeos==1', {
8585 'sources': [
8686 '<(gen_out_dir)/usage_rewriter_data.h',
8787 'usage_rewriter.cc',
168168 '<@(input_files)',
169169 ],
170170 },
171 {
172 'action_name': 'gen_usage_rewriter_data',
173 'variables': {
174 'usage_data_file': [
175 '<(DEPTH)/third_party/japanese_usage_dictionary/usage_dict.txt',
176 ],
177 'cforms_file': [
178 '../data/rules/cforms.def',
179 ],
180 },
181 'inputs': [
182 '<@(usage_data_file)',
183 '<@(cforms_file)',
184 ],
185 'conditions': [['two_pass_build==0', {
186 'inputs': [
187 '<(mozc_build_tools_dir)/gen_usage_rewriter_dictionary_main',
188 ],
189 }]],
190 'outputs': [
191 '<(gen_out_dir)/usage_rewriter_data.h',
192 ],
193 'action': [
194 '<(mozc_build_tools_dir)/gen_usage_rewriter_dictionary_main',
195 '--usage_data_file=<@(usage_data_file)',
196 '--cforms_file=<@(cforms_file)',
197 '--logtostderr',
198 '--output=<(gen_out_dir)/usage_rewriter_data.h',
199 ],
200 },
201 ],
202 'conditions': [['two_pass_build==0', {
203 'dependencies': [
204 'install_gen_collocation_data_main',
205 'install_gen_emoticon_rewriter_dictionary_main',
206 'install_gen_single_kanji_rewriter_dictionary_main',
207 'install_gen_symbol_rewriter_dictionary_main',
208 'install_gen_usage_rewriter_dictionary_main',
209 ],
210 }]],
171 ],
172 'conditions': [
173 ['OS=="mac" or OS=="win" or chromeos==1', {
174 'actions': [
175 {
176 'action_name': 'gen_usage_rewriter_data',
177 'variables': {
178 'usage_data_file': [
179 '<(DEPTH)/third_party/japanese_usage_dictionary/usage_dict.txt',
180 ],
181 'cforms_file': [
182 '../data/rules/cforms.def',
183 ],
184 },
185 'inputs': [
186 '<@(usage_data_file)',
187 '<@(cforms_file)',
188 ],
189 'outputs': [
190 '<(gen_out_dir)/usage_rewriter_data.h',
191 ],
192 'action': [
193 '<(mozc_build_tools_dir)/gen_usage_rewriter_dictionary_main',
194 '--usage_data_file=<@(usage_data_file)',
195 '--cforms_file=<@(cforms_file)',
196 '--logtostderr',
197 '--output=<(gen_out_dir)/usage_rewriter_data.h',
198 ],
199 },
200 ],
201 }],
202 ],
211203 },
212204 {
213205 'target_name': 'gen_collocation_data_main',
8282 'longname': ['%s (Japanese keyboard layout)', '%s (US keyboard layout)',
8383 '%s (US Dvorak keyboard layout)'],
8484 'layout': ['jp', 'us', 'us(dvorak)'],
85 # hotkeys property is Chrome/Chromium OS specific. Upstream ibus-daemon
86 # doesn't support this.
87 'hotkeys': ['Henkan,Zenkaku_Hankaku', '', ''],
8885 },
8986 }
9087
164161 for key in engine_common:
165162 OutputCppVariable(product_name, 'Engine', key, engine_common[key])
166163 for key in engines:
167 if key == 'hotkeys':
168 # Skip hotkeys because it is not used from C++ code.
169 continue
170164 print 'const char* kEngine%sArray[] = {' % key.capitalize()
171165 for i in range(len(engines[key])):
172166 print '"%s",' % EmbedProductName(product_name, engines[key][i])
139139
140140 int main(gint argc, gchar **argv) {
141141 InitGoogle(argv[0], &argc, &argv, true);
142 #ifdef OS_CHROMEOS
143 // On Chrome OS, mozc does not store the config data to a local file.
144 mozc::config::ConfigHandler::SetConfigFileName("memory://config.1.db");
145 mozc::session::JapaneseSessionFactory session_factory;
146 mozc::session::SessionFactoryManager::SetSessionFactory(&session_factory);
147 #endif // OS_CHROMEOS
142148 ibus_init();
143149 InitIBusComponent(FLAGS_ibus);
144150 #ifdef OS_CHROMEOS
145 // On Chrome OS, mozc does not store the config data to a local file.
146 mozc::config::ConfigHandler::SetConfigFileName("memory://config.1.db");
147151 mozc::ibus::MozcEngine::InitConfig(g_config);
148 mozc::session::JapaneseSessionFactory session_factory;
149 mozc::session::SessionFactoryManager::SetSessionFactory(&session_factory);
150152 #else
151153 #ifndef NO_LOGGING
152154 EnableVerboseLog();
948948
949949 for (int i = 0; i < candidates.candidate_size(); ++i) {
950950 const commands::Candidates::Candidate &candidate = candidates.candidate(i);
951
952 #ifdef OS_CHROMEOS
953 const bool has_description = candidate.has_annotation() &&
954 candidate.annotation().has_description();
955 IBusText *text = NULL;
956 if (has_description) {
957 // |kDelimiter| divides a candidate and an annotation.
958 static const char kDelimiter[] = " ";
959
960 // Append an annotation to a candidate word. Both are separated
961 // by |kDelimiter|.
962 text = ibus_text_new_from_string(
963 (candidate.value() + kDelimiter +
964 candidate.annotation().description()).c_str());
965
966 // The candidate window on Chrome OS will know
967 // the start index of an annotation by specific number (e.g. 0x888888).
968 // TODO(nhiroki): We should modify the way when iBus supports annotations.
969 const guint kAnnotationForegroundColor = 0x888888;
970
971 // Insert an attribute. It incidates annotation's
972 // start and end index.
973 const guint start = Util::CharsLen(candidate.value() + kDelimiter);
974 const guint end = start +
975 Util::CharsLen(candidate.annotation().description());
976 ibus_text_append_attribute(text,
977 IBUS_ATTR_TYPE_FOREGROUND,
978 kAnnotationForegroundColor,
979 start,
980 end);
981 } else {
982 text = ibus_text_new_from_string(candidate.value().c_str());
983 }
984 #else
985951 IBusText *text = ibus_text_new_from_string(candidate.value().c_str());
986 #endif
987
988952 ibus_lookup_table_append_candidate(table, text);
989953 // |text| is released by ibus_engine_update_lookup_table along with |table|.
990954
1002966 // |label| is released by ibus_engine_update_lookup_table along with
1003967 // |table|.
1004968 }
969
970 #if defined(OS_CHROMEOS) and IBUS_CHECK_VERSION(1, 3, 99)
971 // The function ibus_serializable_set_attachment() had been changed
972 // to use GVariant in ibus-1.3.99.
973 // https://github.com/ibus/ibus/commit/ac9dfac13cef34288440a2ecdf067cd827fb2f8f
974 // But these codes are valid only for ChromeOS since:
975 // 1) IBus's default panel (main.py) does not support the attachment.
976 // 2) Ubuntu 10.10 uses ibus-1.3.99, but the version of ibus it uses is
977 // very old.
978 // If we only use IBUS_CHECK_VERSION, ibus-mozc does not compile on
979 // Ubuntu 10.10.
980 // Also we do not use only OS_CHROMEOS, because we will compile ibus-mozc for
981 // ChromeOS on Ubuntu for debugging even if following feature is missed.
982 if (output.has_candidates()) {
983 string buf;
984 output.candidates().SerializeToString(&buf);
985
986 GByteArray *bytearray = g_byte_array_sized_new(buf.length());
987 g_byte_array_append(bytearray,
988 reinterpret_cast<const guint8*>(buf.c_str()), buf.length());
989 GVariant* variant = g_variant_new_from_data(G_VARIANT_TYPE("ay"),
990 bytearray->data, bytearray->len, TRUE,
991 reinterpret_cast<GDestroyNotify>(g_byte_array_unref), bytearray);
992 ibus_serializable_set_attachment(
993 IBUS_SERIALIZABLE(table), "mozc.candidates", variant);
994 }
995 #endif
996
1005997 ibus_engine_update_lookup_table(engine, table, TRUE);
1006998 // |table| is released by ibus_engine_update_lookup_table.
1007999
4747 mozc::client::ServerLauncherInterface *server_launcher,
4848 mozc::IPCClientFactoryInterface *client_factory)
4949 : translator_(new ScimKeyTranslator),
50 server_launcher_(server_launcher),
51 client_factory_(client_factory),
5250 preedit_method_(mozc::config::Config::ROMAN) {
5351 VLOG(1) << "MozcConnection is created";
5452 mozc::client::ClientInterface *client =
5553 mozc::client::ClientFactory::NewClient();
56 client->SetServerLauncher(server_launcher_);
57 client->SetIPCClientFactory(client_factory_.get());
54 client->SetServerLauncher(server_launcher);
55 client->SetIPCClientFactory(client_factory);
5856 client_.reset(client);
5957
6058 mozc::config::Config config;
123123
124124 const scoped_ptr<ScimKeyTranslator> translator_;
125125 scoped_ptr<mozc::client::ClientInterface> client_;
126 mozc::client::ServerLauncherInterface *server_launcher_;
127 scoped_ptr<mozc::IPCClientFactoryInterface> client_factory_;
128126 mozc::config::Config::PreeditMethod preedit_method_;
129127
130128 DISALLOW_COPY_AND_ASSIGN(MozcConnection);
0 mozc (1.2.855.102) lucid; urgency=low
1
2 * Ver. 1.2.855.102 on 2011-09-27
3
4 -- Tsuyoshi Horo <horo> Tue, 27 Sep 2011 15:55:43 +0900
5
06 mozc (1.2.831.102) lucid; urgency=low
17
28 * Updated dictionary.