1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "jingle/notifier/base/notification_method.h"
7 #include "base/logging.h"
11 const NotificationMethod kDefaultNotificationMethod = NOTIFICATION_SERVER;
13 std::string NotificationMethodToString(
14 NotificationMethod notification_method) {
15 switch (notification_method) {
16 case NOTIFICATION_P2P:
17 return "NOTIFICATION_P2P";
19 case NOTIFICATION_SERVER:
20 return "NOTIFICATION_SERVER";
23 LOG(WARNING) << "Unknown value for notification method: "
24 << notification_method;
27 return "<unknown notification method>";
30 NotificationMethod StringToNotificationMethod(const std::string& str) {
32 return NOTIFICATION_P2P;
33 } else if (str == "server") {
34 return NOTIFICATION_SERVER;
36 LOG(WARNING) << "Unknown notification method \"" << str
37 << "\"; using method "
38 << NotificationMethodToString(kDefaultNotificationMethod);
39 return kDefaultNotificationMethod;
42 } // namespace notifier