OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Utility functions. | 5 // Utility functions. |
6 | 6 |
7 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_BASE_UTILS_H_ | 7 #ifndef CHROME_COMMON_NET_NOTIFIER_BASE_UTILS_H_ |
8 #define CHROME_BROWSER_SYNC_NOTIFIER_BASE_UTILS_H_ | 8 #define CHROME_COMMON_NET_NOTIFIER_BASE_UTILS_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "chrome/browser/sync/notifier/base/static_assert.h" | 13 #include "chrome/common/net/notifier/base/static_assert.h" |
14 | 14 |
15 // Return error if the first argument evaluates to false. | 15 // Return error if the first argument evaluates to false. |
16 #define RET_IF_FALSE(x) do { if (!(x)) return false; } while (false) | 16 #define RET_IF_FALSE(x) do { if (!(x)) return false; } while (false) |
17 | 17 |
18 // Protocol constants. | 18 // Protocol constants. |
19 const char kHttpProto[] = "http://"; | 19 const char kHttpProto[] = "http://"; |
20 const char kHttpsProto[] = "https://"; | 20 const char kHttpsProto[] = "https://"; |
21 | 21 |
22 // Initialize a POD to zero. Using this function requires discipline. Don't | 22 // Initialize a POD to zero. Using this function requires discipline. Don't |
23 // use for types that have a v-table or virtual bases. | 23 // use for types that have a v-table or virtual bases. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void GetMapElement(const std::map<const std::string, const T>& m, | 80 void GetMapElement(const std::map<const std::string, const T>& m, |
81 const char* name, | 81 const char* name, |
82 T* value) { | 82 T* value) { |
83 typename std::map<const std::string, const T>::const_iterator iter( | 83 typename std::map<const std::string, const T>::const_iterator iter( |
84 m.find(name)); | 84 m.find(name)); |
85 if (iter != m.end()) { | 85 if (iter != m.end()) { |
86 *value = iter->second; | 86 *value = iter->second; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 #endif // CHROME_BROWSER_SYNC_NOTIFIER_BASE_UTILS_H_ | 90 #endif // CHROME_COMMON_NET_NOTIFIER_BASE_UTILS_H_ |
OLD | NEW |