OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/notifications/notification_id_generator.h" | 5 #include "content/browser/notifications/notification_id_generator.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 stream << kNonPersistentPrefix; | 99 stream << kNonPersistentPrefix; |
100 stream << ComputeBrowserContextHash(browser_context_); | 100 stream << ComputeBrowserContextHash(browser_context_); |
101 stream << base::IntToString(browser_context_->IsOffTheRecord()); | 101 stream << base::IntToString(browser_context_->IsOffTheRecord()); |
102 stream << origin; | 102 stream << origin; |
103 | 103 |
104 // Non-persistent notification ids are unique per renderer process when no | 104 // Non-persistent notification ids are unique per renderer process when no |
105 // tag is being used. Tags still identify uniqueness for the given origin. | 105 // tag is being used. Tags still identify uniqueness for the given origin. |
106 | 106 |
107 stream << base::IntToString(!tag.empty()); | 107 stream << base::IntToString(!tag.empty()); |
108 if (!tag.size()) { | 108 if (tag.empty()) { |
109 stream << base::IntToString(render_process_id_); | 109 stream << base::IntToString(render_process_id_); |
110 stream << kSeparator; | 110 stream << kSeparator; |
111 | 111 |
112 stream << base::IntToString(non_persistent_notification_id); | 112 stream << base::IntToString(non_persistent_notification_id); |
113 } else { | 113 } else { |
114 stream << tag; | 114 stream << tag; |
115 } | 115 } |
116 | 116 |
117 return stream.str(); | 117 return stream.str(); |
118 } | 118 } |
119 | 119 |
120 } // namespace content | 120 } // namespace content |
OLD | NEW |