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/sync_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/sync_internals_message_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 Value(base::FeatureList::IsEnabled(switches::kSyncUserEvents))); | 208 Value(base::FeatureList::IsEnabled(switches::kSyncUserEvents))); |
209 } | 209 } |
210 | 210 |
211 void SyncInternalsMessageHandler::HandleWriteUserEvent( | 211 void SyncInternalsMessageHandler::HandleWriteUserEvent( |
212 const base::ListValue* args) { | 212 const base::ListValue* args) { |
213 DCHECK_EQ(2U, args->GetSize()); | 213 DCHECK_EQ(2U, args->GetSize()); |
214 AllowJavascript(); | 214 AllowJavascript(); |
215 | 215 |
216 Profile* profile = Profile::FromWebUI(web_ui()); | 216 Profile* profile = Profile::FromWebUI(web_ui()); |
217 syncer::UserEventService* user_event_service = | 217 syncer::UserEventService* user_event_service = |
218 browser_sync::UserEventServiceFactory::GetForProfile( | 218 browser_sync::UserEventServiceFactory::GetForProfile(profile); |
219 profile->GetOriginalProfile()); | |
220 | 219 |
221 sync_pb::UserEventSpecifics event_specifics; | 220 sync_pb::UserEventSpecifics event_specifics; |
222 event_specifics.set_event_time_usec(StringAtIndexToInt64(args, 0)); | 221 event_specifics.set_event_time_usec(StringAtIndexToInt64(args, 0)); |
223 event_specifics.set_navigation_id(StringAtIndexToInt64(args, 1)); | 222 event_specifics.set_navigation_id(StringAtIndexToInt64(args, 1)); |
224 user_event_service->RecordUserEvent(event_specifics); | 223 user_event_service->RecordUserEvent(event_specifics); |
225 } | 224 } |
226 | 225 |
227 void SyncInternalsMessageHandler::OnReceivedAllNodes( | 226 void SyncInternalsMessageHandler::OnReceivedAllNodes( |
228 int request_id, | 227 int request_id, |
229 std::unique_ptr<ListValue> nodes) { | 228 std::unique_ptr<ListValue> nodes) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 js_controller_->RemoveJsEventHandler(this); | 308 js_controller_->RemoveJsEventHandler(this); |
310 js_controller_ = nullptr; | 309 js_controller_ = nullptr; |
311 is_registered_ = false; | 310 is_registered_ = false; |
312 } | 311 } |
313 | 312 |
314 if (is_registered_for_counters_) { | 313 if (is_registered_for_counters_) { |
315 service->RemoveTypeDebugInfoObserver(this); | 314 service->RemoveTypeDebugInfoObserver(this); |
316 is_registered_for_counters_ = false; | 315 is_registered_for_counters_ = false; |
317 } | 316 } |
318 } | 317 } |
OLD | NEW |