OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/app_notification.h" | 5 #include "chrome/browser/extensions/app_notification.h" |
6 | 6 |
| 7 #include "base/guid.h" |
7 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
8 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/common/guid.h" | |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const char* kIsLocalKey = "is_local"; | 14 const char* kIsLocalKey = "is_local"; |
15 const char* kCreationTime= "creation_time"; | 15 const char* kCreationTime= "creation_time"; |
16 const char* kGuidKey = "guid"; | 16 const char* kGuidKey = "guid"; |
17 const char* kExtensionIdKey = "extension_id"; | 17 const char* kExtensionIdKey = "extension_id"; |
18 const char* kTitleKey = "title"; | 18 const char* kTitleKey = "title"; |
19 const char* kBodyKey = "body"; | 19 const char* kBodyKey = "body"; |
20 const char* kLinkUrlKey = "link_url"; | 20 const char* kLinkUrlKey = "link_url"; |
21 const char* kLinkTextKey = "link_text"; | 21 const char* kLinkTextKey = "link_text"; |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 AppNotification::AppNotification(bool is_local, | 25 AppNotification::AppNotification(bool is_local, |
26 const base::Time& creation_time, | 26 const base::Time& creation_time, |
27 const std::string& guid, | 27 const std::string& guid, |
28 const std::string& extension_id, | 28 const std::string& extension_id, |
29 const std::string& title, | 29 const std::string& title, |
30 const std::string& body) | 30 const std::string& body) |
31 : is_local_(is_local), | 31 : is_local_(is_local), |
32 creation_time_(creation_time), | 32 creation_time_(creation_time), |
33 extension_id_(extension_id), | 33 extension_id_(extension_id), |
34 title_(title), | 34 title_(title), |
35 body_(body) { | 35 body_(body) { |
36 guid_ = guid.empty() ? guid::GenerateGUID() : guid; | 36 guid_ = guid.empty() ? base::GenerateGUID() : guid; |
37 } | 37 } |
38 | 38 |
39 AppNotification::~AppNotification() {} | 39 AppNotification::~AppNotification() {} |
40 | 40 |
41 AppNotification* AppNotification::Copy() { | 41 AppNotification* AppNotification::Copy() { |
42 AppNotification* copy = new AppNotification( | 42 AppNotification* copy = new AppNotification( |
43 this->is_local(), this->creation_time(), | 43 this->is_local(), this->creation_time(), |
44 this->guid(), this->extension_id(), | 44 this->guid(), this->extension_id(), |
45 this->title(), this->body()); | 45 this->title(), this->body()); |
46 copy->set_link_url(this->link_url()); | 46 copy->set_link_url(this->link_url()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 AppNotificationList* CopyAppNotificationList( | 146 AppNotificationList* CopyAppNotificationList( |
147 const AppNotificationList& source) { | 147 const AppNotificationList& source) { |
148 AppNotificationList* copy = new AppNotificationList(); | 148 AppNotificationList* copy = new AppNotificationList(); |
149 | 149 |
150 for (AppNotificationList::const_iterator iter = source.begin(); | 150 for (AppNotificationList::const_iterator iter = source.begin(); |
151 iter != source.end(); ++iter) { | 151 iter != source.end(); ++iter) { |
152 copy->push_back(linked_ptr<AppNotification>(iter->get()->Copy())); | 152 copy->push_back(linked_ptr<AppNotification>(iter->get()->Copy())); |
153 } | 153 } |
154 return copy; | 154 return copy; |
155 } | 155 } |
OLD | NEW |