OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/notifications/notification_platform_bridge_linux.h" | 5 #include "chrome/browser/notifications/notification_platform_bridge_linux.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
454 base::ContainsKey(capabilities_, kCapabilityBodyImages))); | 454 base::ContainsKey(capabilities_, kCapabilityBodyImages))); |
455 | 455 |
456 dbus::MethodCall get_server_information_call(kFreedesktopNotificationsName, | 456 dbus::MethodCall get_server_information_call(kFreedesktopNotificationsName, |
457 kMethodGetServerInformation); | 457 kMethodGetServerInformation); |
458 std::unique_ptr<dbus::Response> server_information_response = | 458 std::unique_ptr<dbus::Response> server_information_response = |
459 notification_proxy_->CallMethodAndBlock( | 459 notification_proxy_->CallMethodAndBlock( |
460 &get_server_information_call, | 460 &get_server_information_call, |
461 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT); | 461 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT); |
462 if (server_information_response) { | 462 if (server_information_response) { |
463 dbus::MessageReader reader(server_information_response.get()); | 463 dbus::MessageReader reader(server_information_response.get()); |
464 std::string name; | |
464 std::string spec_version; | 465 std::string spec_version; |
465 reader.PopString(&spec_version); // name | 466 reader.PopString(&name); // name |
466 reader.PopString(&spec_version); // vendor | 467 reader.PopString(&spec_version); // vendor |
467 reader.PopString(&spec_version); // version | 468 reader.PopString(&spec_version); // version |
468 reader.PopString(&spec_version); // spec_version | 469 reader.PopString(&spec_version); // spec_version |
470 // Hack for xfce4-notifyd. It says it only supports spec | |
Lei Zhang
2017/05/15 22:32:06
Can you reference https://bugzilla.xfce.org/show_b
| |
471 // version 0.9, but really supports version 1.2. | |
472 if (name == "Xfce Notify Daemon" && spec_version == "0.9") | |
473 spec_version = "1.2"; | |
469 spec_version_ = base::Version(spec_version); | 474 spec_version_ = base::Version(spec_version); |
470 } | 475 } |
471 // The minimum supported spec version is 1.1, because this was the | 476 // The minimum supported spec version is 1.1, because this was the |
472 // version that added image hints. | 477 // version that added image hints. |
473 if (!spec_version_.IsValid() || | 478 if (!spec_version_.IsValid() || |
474 spec_version_ < base::Version(std::vector<uint32_t>{1, 1})) { | 479 spec_version_ < base::Version(std::vector<uint32_t>{1, 1})) { |
475 OnConnectionInitializationFinishedOnTaskRunner( | 480 OnConnectionInitializationFinishedOnTaskRunner( |
476 ConnectionInitializationStatusCode::INCOMPATIBLE_SPEC_VERSION); | 481 ConnectionInitializationStatusCode::INCOMPATIBLE_SPEC_VERSION); |
477 return; | 482 return; |
478 } | 483 } |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
947 } | 952 } |
948 | 953 |
949 void NotificationPlatformBridgeLinux::SetReadyCallback( | 954 void NotificationPlatformBridgeLinux::SetReadyCallback( |
950 NotificationBridgeReadyCallback callback) { | 955 NotificationBridgeReadyCallback callback) { |
951 impl_->SetReadyCallback(std::move(callback)); | 956 impl_->SetReadyCallback(std::move(callback)); |
952 } | 957 } |
953 | 958 |
954 void NotificationPlatformBridgeLinux::CleanUp() { | 959 void NotificationPlatformBridgeLinux::CleanUp() { |
955 impl_->CleanUp(); | 960 impl_->CleanUp(); |
956 } | 961 } |
OLD | NEW |