OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/webui/invalidations_message_handler.h" | 5 #include "chrome/browser/ui/webui/invalidations_message_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 8 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "components/invalidation/impl/invalidation_logger.h" | 10 #include "components/invalidation/impl/invalidation_logger.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 base::FundamentalValue(last_changed_timestamp.ToJsTime())); | 91 base::FundamentalValue(last_changed_timestamp.ToJsTime())); |
92 } | 92 } |
93 | 93 |
94 void InvalidationsMessageHandler::OnUpdateIds( | 94 void InvalidationsMessageHandler::OnUpdateIds( |
95 const std::string& handler_name, | 95 const std::string& handler_name, |
96 const syncer::ObjectIdCountMap& ids) { | 96 const syncer::ObjectIdCountMap& ids) { |
97 base::ListValue list_of_objects; | 97 base::ListValue list_of_objects; |
98 for (syncer::ObjectIdCountMap::const_iterator it = ids.begin(); | 98 for (syncer::ObjectIdCountMap::const_iterator it = ids.begin(); |
99 it != ids.end(); | 99 it != ids.end(); |
100 ++it) { | 100 ++it) { |
101 scoped_ptr<base::DictionaryValue> dic(new base::DictionaryValue()); | 101 std::unique_ptr<base::DictionaryValue> dic(new base::DictionaryValue()); |
102 dic->SetString("name", (it->first).name()); | 102 dic->SetString("name", (it->first).name()); |
103 dic->SetInteger("source", (it->first).source()); | 103 dic->SetInteger("source", (it->first).source()); |
104 dic->SetInteger("totalCount", it->second); | 104 dic->SetInteger("totalCount", it->second); |
105 list_of_objects.Append(dic.release()); | 105 list_of_objects.Append(dic.release()); |
106 } | 106 } |
107 web_ui()->CallJavascriptFunction("chrome.invalidations.updateIds", | 107 web_ui()->CallJavascriptFunction("chrome.invalidations.updateIds", |
108 base::StringValue(handler_name), | 108 base::StringValue(handler_name), |
109 list_of_objects); | 109 list_of_objects); |
110 } | 110 } |
111 void InvalidationsMessageHandler::OnDebugMessage( | 111 void InvalidationsMessageHandler::OnDebugMessage( |
112 const base::DictionaryValue& details) {} | 112 const base::DictionaryValue& details) {} |
113 | 113 |
114 void InvalidationsMessageHandler::OnInvalidation( | 114 void InvalidationsMessageHandler::OnInvalidation( |
115 const syncer::ObjectIdInvalidationMap& new_invalidations) { | 115 const syncer::ObjectIdInvalidationMap& new_invalidations) { |
116 scoped_ptr<base::ListValue> invalidations_list = new_invalidations.ToValue(); | 116 std::unique_ptr<base::ListValue> invalidations_list = |
| 117 new_invalidations.ToValue(); |
117 web_ui()->CallJavascriptFunction("chrome.invalidations.logInvalidations", | 118 web_ui()->CallJavascriptFunction("chrome.invalidations.logInvalidations", |
118 *invalidations_list); | 119 *invalidations_list); |
119 } | 120 } |
120 | 121 |
121 void InvalidationsMessageHandler::OnDetailedStatus( | 122 void InvalidationsMessageHandler::OnDetailedStatus( |
122 const base::DictionaryValue& network_details) { | 123 const base::DictionaryValue& network_details) { |
123 web_ui()->CallJavascriptFunction("chrome.invalidations.updateDetailedStatus", | 124 web_ui()->CallJavascriptFunction("chrome.invalidations.updateDetailedStatus", |
124 network_details); | 125 network_details); |
125 } | 126 } |
OLD | NEW |