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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 10 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 web_ui()->CallJavascriptFunctionUnsafe("chrome.invalidations.updateHandlers", | 83 web_ui()->CallJavascriptFunctionUnsafe("chrome.invalidations.updateHandlers", |
84 list_of_handlers); | 84 list_of_handlers); |
85 } | 85 } |
86 | 86 |
87 void InvalidationsMessageHandler::OnStateChange( | 87 void InvalidationsMessageHandler::OnStateChange( |
88 const syncer::InvalidatorState& new_state, | 88 const syncer::InvalidatorState& new_state, |
89 const base::Time& last_changed_timestamp) { | 89 const base::Time& last_changed_timestamp) { |
90 std::string state(syncer::InvalidatorStateToString(new_state)); | 90 std::string state(syncer::InvalidatorStateToString(new_state)); |
91 web_ui()->CallJavascriptFunctionUnsafe( | 91 web_ui()->CallJavascriptFunctionUnsafe( |
92 "chrome.invalidations.updateInvalidatorState", base::StringValue(state), | 92 "chrome.invalidations.updateInvalidatorState", base::StringValue(state), |
93 base::FundamentalValue(last_changed_timestamp.ToJsTime())); | 93 base::Value(last_changed_timestamp.ToJsTime())); |
94 } | 94 } |
95 | 95 |
96 void InvalidationsMessageHandler::OnUpdateIds( | 96 void InvalidationsMessageHandler::OnUpdateIds( |
97 const std::string& handler_name, | 97 const std::string& handler_name, |
98 const syncer::ObjectIdCountMap& ids) { | 98 const syncer::ObjectIdCountMap& ids) { |
99 base::ListValue list_of_objects; | 99 base::ListValue list_of_objects; |
100 for (syncer::ObjectIdCountMap::const_iterator it = ids.begin(); | 100 for (syncer::ObjectIdCountMap::const_iterator it = ids.begin(); |
101 it != ids.end(); | 101 it != ids.end(); |
102 ++it) { | 102 ++it) { |
103 std::unique_ptr<base::DictionaryValue> dic(new base::DictionaryValue()); | 103 std::unique_ptr<base::DictionaryValue> dic(new base::DictionaryValue()); |
(...skipping 15 matching lines...) Expand all Loading... |
119 new_invalidations.ToValue(); | 119 new_invalidations.ToValue(); |
120 web_ui()->CallJavascriptFunctionUnsafe( | 120 web_ui()->CallJavascriptFunctionUnsafe( |
121 "chrome.invalidations.logInvalidations", *invalidations_list); | 121 "chrome.invalidations.logInvalidations", *invalidations_list); |
122 } | 122 } |
123 | 123 |
124 void InvalidationsMessageHandler::OnDetailedStatus( | 124 void InvalidationsMessageHandler::OnDetailedStatus( |
125 const base::DictionaryValue& network_details) { | 125 const base::DictionaryValue& network_details) { |
126 web_ui()->CallJavascriptFunctionUnsafe( | 126 web_ui()->CallJavascriptFunctionUnsafe( |
127 "chrome.invalidations.updateDetailedStatus", network_details); | 127 "chrome.invalidations.updateDetailedStatus", network_details); |
128 } | 128 } |
OLD | NEW |