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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (logger_) | 69 if (logger_) |
70 logger_->EmitContent(); | 70 logger_->EmitContent(); |
71 } | 71 } |
72 | 72 |
73 void InvalidationsMessageHandler::OnRegistrationChange( | 73 void InvalidationsMessageHandler::OnRegistrationChange( |
74 const std::multiset<std::string>& registered_handlers) { | 74 const std::multiset<std::string>& registered_handlers) { |
75 base::ListValue list_of_handlers; | 75 base::ListValue list_of_handlers; |
76 for (std::multiset<std::string>::const_iterator it = | 76 for (std::multiset<std::string>::const_iterator it = |
77 registered_handlers.begin(); | 77 registered_handlers.begin(); |
78 it != registered_handlers.end(); ++it) { | 78 it != registered_handlers.end(); ++it) { |
79 list_of_handlers.Append(new base::StringValue(*it)); | 79 list_of_handlers.AppendString(*it); |
80 } | 80 } |
81 web_ui()->CallJavascriptFunction("chrome.invalidations.updateHandlers", | 81 web_ui()->CallJavascriptFunction("chrome.invalidations.updateHandlers", |
82 list_of_handlers); | 82 list_of_handlers); |
83 } | 83 } |
84 | 84 |
85 void InvalidationsMessageHandler::OnStateChange( | 85 void InvalidationsMessageHandler::OnStateChange( |
86 const syncer::InvalidatorState& new_state, | 86 const syncer::InvalidatorState& new_state, |
87 const base::Time& last_changed_timestamp) { | 87 const base::Time& last_changed_timestamp) { |
88 std::string state(syncer::InvalidatorStateToString(new_state)); | 88 std::string state(syncer::InvalidatorStateToString(new_state)); |
89 web_ui()->CallJavascriptFunction( | 89 web_ui()->CallJavascriptFunction( |
(...skipping 27 matching lines...) Expand all Loading... |
117 new_invalidations.ToValue(); | 117 new_invalidations.ToValue(); |
118 web_ui()->CallJavascriptFunction("chrome.invalidations.logInvalidations", | 118 web_ui()->CallJavascriptFunction("chrome.invalidations.logInvalidations", |
119 *invalidations_list); | 119 *invalidations_list); |
120 } | 120 } |
121 | 121 |
122 void InvalidationsMessageHandler::OnDetailedStatus( | 122 void InvalidationsMessageHandler::OnDetailedStatus( |
123 const base::DictionaryValue& network_details) { | 123 const base::DictionaryValue& network_details) { |
124 web_ui()->CallJavascriptFunction("chrome.invalidations.updateDetailedStatus", | 124 web_ui()->CallJavascriptFunction("chrome.invalidations.updateDetailedStatus", |
125 network_details); | 125 network_details); |
126 } | 126 } |
OLD | NEW |