Imported Upstream version 0.12.434.102
Nobuhiro Iwamatsu
13 years ago
350 | 350 | LinuxStatsConfigUtilImpl::~LinuxStatsConfigUtilImpl() {} |
351 | 351 | |
352 | 352 | bool LinuxStatsConfigUtilImpl::IsEnabled() { |
353 | return true; | |
353 | return false; | |
354 | 354 | } |
355 | 355 | |
356 | 356 | bool LinuxStatsConfigUtilImpl::SetEnabled(bool val) { |
839 | 839 | } // namespace mozc |
840 | 840 | #endif // OS_WINDOWS |
841 | 841 | |
842 | #ifdef OS_LINUX | |
843 | TEST(StatsConfigUtilTestLinux, DefaultValueTest) { | |
844 | EXPECT_FALSE(mozc::StatsConfigUtil::IsEnabled()); | |
845 | } | |
846 | #endif |
9 | 9 | (like 社員証, 再起動) are added. We basically collected these compounds |
10 | 10 | with a set of POS rules. |
11 | 11 | - Open source version doesn't include Katakana transliterations. |
12 | (あんどろいど->Android) | |
12 | (いんたーねっと->Internet) | |
13 | 13 | - Open source version doesn't include Japanese postal code dictionary . |
14 | 14 | |
15 | 15 | You can add zip code dictionary by follows: |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
339 | 339 | } |
340 | 340 | |
341 | 341 | void ConfigDialog::SetSendStatsCheckBox() { |
342 | // On windows, usage_stats flag is managed by | |
343 | // administration_dialog. http://b/issue?id=2889759 | |
344 | #ifndef OS_WINDOWS | |
342 | 345 | const bool val = StatsConfigUtil::IsEnabled(); |
343 | 346 | usageStatsCheckBox->setChecked(val); |
347 | #endif // OS_WINDOWS | |
344 | 348 | } |
345 | 349 | |
346 | 350 | void ConfigDialog::GetSendStatsCheckBox() const { |
351 | // On windows, usage_stats flag is managed by | |
352 | // administration_dialog. http://b/issue?id=2889759 | |
353 | #ifndef OS_WINDOWS | |
347 | 354 | const bool val = usageStatsCheckBox->isChecked(); |
348 | 355 | StatsConfigUtil::SetEnabled(val); |
356 | #endif // OS_WINDOWS | |
349 | 357 | } |
350 | 358 | |
351 | 359 | #define SET_COMBOBOX(combobox, enumname, field) \ |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
264 | 264 | *ipc_name = kIPCPrefix; |
265 | 265 | #endif // OS_WINDOWS |
266 | 266 | |
267 | #ifdef OS_LINUX | |
268 | // On Linux, use abstract namespace which is independent of the file system. | |
269 | (*ipc_name)[0] = '\0'; | |
270 | #endif | |
271 | ||
267 | 272 | ipc_name->append(ipc_path_info_->key()); |
268 | 273 | ipc_name->append("."); |
269 | 274 | ipc_name->append(name_); |
358 | 363 | char filename[512]; |
359 | 364 | snprintf(proc, sizeof(proc) - 1, "/proc/%u/exe", server_pid_); |
360 | 365 | const ssize_t size = readlink(proc, filename, sizeof(filename) - 1); |
361 | if (size == static_cast<size_t>(-1)) { | |
366 | if (size == -1) { | |
362 | 367 | LOG(ERROR) << "readlink failed: " << strerror(errno); |
363 | 368 | return false; |
364 | 369 | } |
91 | 91 | EXPECT_FALSE(manager->GetServerProductVersion().empty()); |
92 | 92 | EXPECT_GT(manager->GetServerProcessId(), 0); |
93 | 93 | EXPECT_EQ(t.path(), path); |
94 | #ifdef OS_LINUX | |
95 | // On Linux, |path| should be abstract (see man unix(7) for details.) | |
96 | ASSERT_FALSE(path.empty()); | |
97 | EXPECT_EQ('\0', path[0]); | |
98 | #endif | |
94 | 99 | } |
95 | 100 | |
96 | 101 | // Test the thread-safeness of GetPathName() and |
248 | 248 | << strerror(errno); |
249 | 249 | } |
250 | 250 | } |
251 | ||
252 | // Returns true if address is in abstract namespace. See unix(7) on Linux for | |
253 | // details. | |
254 | bool IsAbstractSocket(const string& address) { | |
255 | return (!address.empty()) && (address[0] == '\0'); | |
256 | } | |
251 | 257 | } // namespace |
252 | 258 | |
253 | 259 | // Client |
408 | 414 | #ifdef OS_MACOSX |
409 | 415 | addr.sun_len = SUN_LEN(&addr); |
410 | 416 | const size_t sun_len = sizeof(addr); |
411 | ::chmod(server_address_.c_str(), 0600); // Linux does not use files for IPC. | |
412 | 417 | #else |
413 | 418 | const size_t sun_len = sizeof(addr.sun_family) + server_address_.size(); |
414 | 419 | #endif |
420 | if (!IsAbstractSocket(server_address_)) { | |
421 | // Linux does not use files for IPC. | |
422 | ::chmod(server_address_.c_str(), 0600); | |
423 | } | |
415 | 424 | if (::bind(socket_, reinterpret_cast<sockaddr *>(&addr), sun_len) != 0) { |
425 | // The UNIX domain socket file (server_address_) already exists? | |
416 | 426 | LOG(FATAL) << "bind() failed: " << strerror(errno); |
417 | 427 | return; |
418 | 428 | } |
437 | 447 | } |
438 | 448 | ::shutdown(socket_, SHUT_RDWR); |
439 | 449 | ::close(socket_); |
440 | #ifdef OS_MACOSX | |
441 | // Since Linux uses abstract namespace, unlink() is not necessary. | |
442 | ::unlink(server_address_.c_str()); | |
443 | #endif | |
450 | if (!IsAbstractSocket(server_address_)) { | |
451 | // When abstract namespace is used, unlink() is not necessary. | |
452 | ::unlink(server_address_.c_str()); | |
453 | } | |
444 | 454 | connected_ = false; |
445 | 455 | socket_ = kInvalidSocket; |
446 | 456 | VLOG(1) << "IPCServer destructed"; |
486 | 496 | |
487 | 497 | ::shutdown(socket_, SHUT_RDWR); |
488 | 498 | ::close(socket_); |
489 | #ifdef OS_MACOSX | |
490 | // Since Linux uses abstract namespace, unlink() is not necessary. | |
491 | ::unlink(server_address_.c_str()); | |
492 | #endif | |
499 | if (!IsAbstractSocket(server_address_)) { | |
500 | // When abstract namespace is used, unlink() is not necessary. | |
501 | ::unlink(server_address_.c_str()); | |
502 | } | |
493 | 503 | connected_ = false; |
494 | 504 | socket_ = kInvalidSocket; |
495 | 505 | } |