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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 9348036: Trim code from sync's ServerConnectionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small updates Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 5056 matching lines...) Expand 10 before | Expand all | Expand 10 after
5067 return_value->SetBoolean("success", true); 5067 return_value->SetBoolean("success", true);
5068 reply.SendSuccess(return_value.get()); 5068 reply.SendSuccess(return_value.get());
5069 } else { 5069 } else {
5070 reply.SendError("Signing in to sync was unsuccessful"); 5070 reply.SendError("Signing in to sync was unsuccessful");
5071 } 5071 }
5072 } 5072 }
5073 5073
5074 // Sample json output: 5074 // Sample json output:
5075 // {u'summary': u'SYNC DISABLED'} 5075 // {u'summary': u'SYNC DISABLED'}
5076 // 5076 //
5077 // { u'authenticated': True, 5077 // { u'last synced': u'Just now',
5078 // u'last synced': u'Just now',
5079 // u'summary': u'READY', 5078 // u'summary': u'READY',
5080 // u'sync url': u'clients4.google.com', 5079 // u'sync url': u'clients4.google.com',
5081 // u'updates received': 42, 5080 // u'updates received': 42,
5082 // u'synced datatypes': [ u'Bookmarks', 5081 // u'synced datatypes': [ u'Bookmarks',
5083 // u'Preferences', 5082 // u'Preferences',
5084 // u'Passwords', 5083 // u'Passwords',
5085 // u'Autofill', 5084 // u'Autofill',
5086 // u'Themes', 5085 // u'Themes',
5087 // u'Extensions', 5086 // u'Extensions',
5088 // u'Apps']} 5087 // u'Apps']}
5089 void TestingAutomationProvider::GetSyncInfo(Browser* browser, 5088 void TestingAutomationProvider::GetSyncInfo(Browser* browser,
5090 DictionaryValue* args, 5089 DictionaryValue* args,
5091 IPC::Message* reply_message) { 5090 IPC::Message* reply_message) {
5092 AutomationJSONReply reply(this, reply_message); 5091 AutomationJSONReply reply(this, reply_message);
5093 DictionaryValue* sync_info = new DictionaryValue; 5092 DictionaryValue* sync_info = new DictionaryValue;
5094 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 5093 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
5095 if (sync_waiter_.get() == NULL) { 5094 if (sync_waiter_.get() == NULL) {
5096 sync_waiter_.reset( 5095 sync_waiter_.reset(
5097 ProfileSyncServiceHarness::CreateAndAttach(browser->profile())); 5096 ProfileSyncServiceHarness::CreateAndAttach(browser->profile()));
5098 } 5097 }
5099 if (!sync_waiter_->IsSyncAlreadySetup()) { 5098 if (!sync_waiter_->IsSyncAlreadySetup()) {
5100 sync_info->SetString("summary", "SYNC DISABLED"); 5099 sync_info->SetString("summary", "SYNC DISABLED");
5101 } else { 5100 } else {
5102 ProfileSyncService* service = sync_waiter_->service(); 5101 ProfileSyncService* service = sync_waiter_->service();
5103 ProfileSyncService::Status status = sync_waiter_->GetStatus(); 5102 ProfileSyncService::Status status = sync_waiter_->GetStatus();
5104 sync_info->SetString("summary", 5103 sync_info->SetString("summary",
5105 ProfileSyncService::BuildSyncStatusSummaryText(status.summary)); 5104 ProfileSyncService::BuildSyncStatusSummaryText(status.summary));
5106 sync_info->SetString("sync url", service->sync_service_url().host()); 5105 sync_info->SetString("sync url", service->sync_service_url().host());
5107 sync_info->SetBoolean("authenticated", status.authenticated);
5108 sync_info->SetString("last synced", service->GetLastSyncedTimeString()); 5106 sync_info->SetString("last synced", service->GetLastSyncedTimeString());
5109 sync_info->SetInteger("updates received", status.updates_received); 5107 sync_info->SetInteger("updates received", status.updates_received);
5110 ListValue* synced_datatype_list = new ListValue; 5108 ListValue* synced_datatype_list = new ListValue;
5111 const syncable::ModelTypeSet synced_datatypes = 5109 const syncable::ModelTypeSet synced_datatypes =
5112 service->GetPreferredDataTypes(); 5110 service->GetPreferredDataTypes();
5113 for (syncable::ModelTypeSet::Iterator it = synced_datatypes.First(); 5111 for (syncable::ModelTypeSet::Iterator it = synced_datatypes.First();
5114 it.Good(); it.Inc()) { 5112 it.Good(); it.Inc()) {
5115 synced_datatype_list->Append( 5113 synced_datatype_list->Append(
5116 new StringValue(syncable::ModelTypeToString(it.Get()))); 5114 new StringValue(syncable::ModelTypeToString(it.Get())));
5117 } 5115 }
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
6940 6938
6941 Send(reply_message_); 6939 Send(reply_message_);
6942 redirect_query_ = 0; 6940 redirect_query_ = 0;
6943 reply_message_ = NULL; 6941 reply_message_ = NULL;
6944 } 6942 }
6945 6943
6946 void TestingAutomationProvider::OnRemoveProvider() { 6944 void TestingAutomationProvider::OnRemoveProvider() {
6947 if (g_browser_process) 6945 if (g_browser_process)
6948 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6946 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6949 } 6947 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/engine/all_status.h » ('j') | chrome/browser/sync/internal_api/sync_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698