Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/ui/webui/invalidations_message_handler.cc

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.AppendString(*it); 79 list_of_handlers.AppendString(*it);
80 } 80 }
81 web_ui()->CallJavascriptFunction("chrome.invalidations.updateHandlers", 81 web_ui()->CallJavascriptFunctionUnsafe("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()->CallJavascriptFunctionUnsafe(
90 "chrome.invalidations.updateInvalidatorState", base::StringValue(state), 90 "chrome.invalidations.updateInvalidatorState", base::StringValue(state),
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 std::unique_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()->CallJavascriptFunctionUnsafe("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 std::unique_ptr<base::ListValue> invalidations_list = 116 std::unique_ptr<base::ListValue> invalidations_list =
117 new_invalidations.ToValue(); 117 new_invalidations.ToValue();
118 web_ui()->CallJavascriptFunction("chrome.invalidations.logInvalidations", 118 web_ui()->CallJavascriptFunctionUnsafe(
119 *invalidations_list); 119 "chrome.invalidations.logInvalidations", *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()->CallJavascriptFunctionUnsafe(
125 network_details); 125 "chrome.invalidations.updateDetailedStatus", network_details);
126 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/instant_ui.cc ('k') | chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698