| 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 <vector> |    7 #include <vector> | 
|    8  |    8  | 
|    9 #include "base/logging.h" |    9 #include "base/logging.h" | 
|   10 #include "chrome/browser/profiles/profile.h" |   10 #include "chrome/browser/profiles/profile.h" | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   50       "requestUpdatedAboutInfo", |   50       "requestUpdatedAboutInfo", | 
|   51       base::Bind(&SyncInternalsMessageHandler::HandleRequestUpdatedAboutInfo, |   51       base::Bind(&SyncInternalsMessageHandler::HandleRequestUpdatedAboutInfo, | 
|   52                  base::Unretained(this))); |   52                  base::Unretained(this))); | 
|   53  |   53  | 
|   54   web_ui()->RegisterMessageCallback( |   54   web_ui()->RegisterMessageCallback( | 
|   55       "requestListOfTypes", |   55       "requestListOfTypes", | 
|   56       base::Bind(&SyncInternalsMessageHandler::HandleRequestListOfTypes, |   56       base::Bind(&SyncInternalsMessageHandler::HandleRequestListOfTypes, | 
|   57                  base::Unretained(this))); |   57                  base::Unretained(this))); | 
|   58  |   58  | 
|   59   RegisterJsControllerCallback("getAllNodes"); |   59   RegisterJsControllerCallback("getAllNodes"); | 
|   60   RegisterJsControllerCallback("getClientServerTraffic"); |  | 
|   61 } |   60 } | 
|   62  |   61  | 
|   63 void SyncInternalsMessageHandler::HandleRegisterForEvents( |   62 void SyncInternalsMessageHandler::HandleRegisterForEvents( | 
|   64     const base::ListValue* args) { |   63     const base::ListValue* args) { | 
|   65   DCHECK(args->empty()); |   64   DCHECK(args->empty()); | 
|   66  |   65  | 
|   67   ProfileSyncService* service = GetProfileSyncService(); |   66   ProfileSyncService* service = GetProfileSyncService(); | 
|   68   if (service) { |   67   if (service) { | 
|   69     service->AddObserver(this); |   68     service->AddObserver(this); | 
|   70     service->AddProtocolEventObserver(this); |   69     service->AddProtocolEventObserver(this); | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  163 } |  162 } | 
|  164  |  163  | 
|  165 // Gets the ProfileSyncService of the underlying original profile. |  164 // Gets the ProfileSyncService of the underlying original profile. | 
|  166 // May return NULL (e.g., if sync is disabled on the command line). |  165 // May return NULL (e.g., if sync is disabled on the command line). | 
|  167 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { |  166 ProfileSyncService* SyncInternalsMessageHandler::GetProfileSyncService() { | 
|  168   Profile* profile = Profile::FromWebUI(web_ui()); |  167   Profile* profile = Profile::FromWebUI(web_ui()); | 
|  169   ProfileSyncServiceFactory* factory = ProfileSyncServiceFactory::GetInstance(); |  168   ProfileSyncServiceFactory* factory = ProfileSyncServiceFactory::GetInstance(); | 
|  170   return factory->GetForProfile(profile->GetOriginalProfile()); |  169   return factory->GetForProfile(profile->GetOriginalProfile()); | 
|  171 } |  170 } | 
|  172  |  171  | 
| OLD | NEW |