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

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: Rebase after Fred's patch Created 8 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/resources/sync_internals/about.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5066 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 return_value->SetBoolean("success", true); 5077 return_value->SetBoolean("success", true);
5078 reply.SendSuccess(return_value.get()); 5078 reply.SendSuccess(return_value.get());
5079 } else { 5079 } else {
5080 reply.SendError("Signing in to sync was unsuccessful"); 5080 reply.SendError("Signing in to sync was unsuccessful");
5081 } 5081 }
5082 } 5082 }
5083 5083
5084 // Sample json output: 5084 // Sample json output:
5085 // {u'summary': u'SYNC DISABLED'} 5085 // {u'summary': u'SYNC DISABLED'}
5086 // 5086 //
5087 // { u'authenticated': True, 5087 // { u'last synced': u'Just now',
5088 // u'last synced': u'Just now',
5089 // u'summary': u'READY', 5088 // u'summary': u'READY',
5090 // u'sync url': u'clients4.google.com', 5089 // u'sync url': u'clients4.google.com',
5091 // u'updates received': 42, 5090 // u'updates received': 42,
5092 // u'synced datatypes': [ u'Bookmarks', 5091 // u'synced datatypes': [ u'Bookmarks',
5093 // u'Preferences', 5092 // u'Preferences',
5094 // u'Passwords', 5093 // u'Passwords',
5095 // u'Autofill', 5094 // u'Autofill',
5096 // u'Themes', 5095 // u'Themes',
5097 // u'Extensions', 5096 // u'Extensions',
5098 // u'Apps']} 5097 // u'Apps']}
5099 void TestingAutomationProvider::GetSyncInfo(Browser* browser, 5098 void TestingAutomationProvider::GetSyncInfo(Browser* browser,
5100 DictionaryValue* args, 5099 DictionaryValue* args,
5101 IPC::Message* reply_message) { 5100 IPC::Message* reply_message) {
5102 AutomationJSONReply reply(this, reply_message); 5101 AutomationJSONReply reply(this, reply_message);
5103 DictionaryValue* sync_info = new DictionaryValue; 5102 DictionaryValue* sync_info = new DictionaryValue;
5104 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 5103 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
5105 if (sync_waiter_.get() == NULL) { 5104 if (sync_waiter_.get() == NULL) {
5106 sync_waiter_.reset( 5105 sync_waiter_.reset(
5107 ProfileSyncServiceHarness::CreateAndAttach(browser->profile())); 5106 ProfileSyncServiceHarness::CreateAndAttach(browser->profile()));
5108 } 5107 }
5109 if (!sync_waiter_->IsSyncAlreadySetup()) { 5108 if (!sync_waiter_->IsSyncAlreadySetup()) {
5110 sync_info->SetString("summary", "SYNC DISABLED"); 5109 sync_info->SetString("summary", "SYNC DISABLED");
5111 } else { 5110 } else {
5112 ProfileSyncService* service = sync_waiter_->service(); 5111 ProfileSyncService* service = sync_waiter_->service();
5113 ProfileSyncService::Status status = sync_waiter_->GetStatus(); 5112 ProfileSyncService::Status status = sync_waiter_->GetStatus();
5114 sync_info->SetString("summary", 5113 sync_info->SetString("summary",
5115 ProfileSyncService::BuildSyncStatusSummaryText(status.summary)); 5114 ProfileSyncService::BuildSyncStatusSummaryText(status.summary));
5116 sync_info->SetString("sync url", service->sync_service_url().host()); 5115 sync_info->SetString("sync url", service->sync_service_url().host());
5117 sync_info->SetBoolean("authenticated", status.authenticated);
5118 sync_info->SetString("last synced", service->GetLastSyncedTimeString()); 5116 sync_info->SetString("last synced", service->GetLastSyncedTimeString());
5119 sync_info->SetInteger("updates received", status.updates_received); 5117 sync_info->SetInteger("updates received", status.updates_received);
5120 ListValue* synced_datatype_list = new ListValue; 5118 ListValue* synced_datatype_list = new ListValue;
5121 const syncable::ModelTypeSet synced_datatypes = 5119 const syncable::ModelTypeSet synced_datatypes =
5122 service->GetPreferredDataTypes(); 5120 service->GetPreferredDataTypes();
5123 for (syncable::ModelTypeSet::Iterator it = synced_datatypes.First(); 5121 for (syncable::ModelTypeSet::Iterator it = synced_datatypes.First();
5124 it.Good(); it.Inc()) { 5122 it.Good(); it.Inc()) {
5125 synced_datatype_list->Append( 5123 synced_datatype_list->Append(
5126 new StringValue(syncable::ModelTypeToString(it.Get()))); 5124 new StringValue(syncable::ModelTypeToString(it.Get())));
5127 } 5125 }
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
7070 7068
7071 Send(reply_message_); 7069 Send(reply_message_);
7072 redirect_query_ = 0; 7070 redirect_query_ = 0;
7073 reply_message_ = NULL; 7071 reply_message_ = NULL;
7074 } 7072 }
7075 7073
7076 void TestingAutomationProvider::OnRemoveProvider() { 7074 void TestingAutomationProvider::OnRemoveProvider() {
7077 if (g_browser_process) 7075 if (g_browser_process)
7078 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7076 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7079 } 7077 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/sync_internals/about.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698