Add performance_tests_browser to the GN build.
[chromium-blink-merge.git] / jingle / notifier / base / notification_method.cc
blob6095ed01462834241a391d110a503801fbbf3804
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"
9 namespace notifier {
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";
18 break;
19 case NOTIFICATION_SERVER:
20 return "NOTIFICATION_SERVER";
21 break;
22 default:
23 LOG(WARNING) << "Unknown value for notification method: "
24 << notification_method;
25 break;
27 return "<unknown notification method>";
30 NotificationMethod StringToNotificationMethod(const std::string& str) {
31 if (str == "p2p") {
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