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

Side by Side Diff: chrome/browser/views/clear_server_data.cc

Issue 3840001: Revert 61848 - [Mac] UI for clearing sync data on the server.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « chrome/browser/views/clear_server_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:eol-style
- LF
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/clear_server_data.h" 5 #include "chrome/browser/views/clear_server_data.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // sync disabled) 279 // sync disabled)
280 UpdateControlEnabledState(); 280 UpdateControlEnabledState();
281 } 281 }
282 282
283 //////////////////////////////////////////////////////////////////////////////// 283 ////////////////////////////////////////////////////////////////////////////////
284 // ClearServerDataView, private: 284 // ClearServerDataView, private:
285 285
286 void ClearServerDataView::UpdateControlEnabledState() { 286 void ClearServerDataView::UpdateControlEnabledState() {
287 bool delete_in_progress = false; 287 bool delete_in_progress = false;
288 288
289 // Succeeded/FailedClearingServerData should only be called once, not every 289 // We only want to call Suceeded/FailedClearingServerData once, not every
290 // time the view is refreshed. As such, on success/failure handle that state 290 // time the view is refreshed. As such, on success/failure we handle that
291 // and immediately reset things back to CLEAR_NOT_STARTED. 291 // state and immediately reset things back to CLEAR_NOT_STARTED.
292 ProfileSyncService::ClearServerDataState clear_state = 292 ProfileSyncService::ClearServerDataState clear_state =
293 (sync_service_ == NULL) ? 293 profile_->GetProfileSyncService()->GetClearServerDataState();
294 ProfileSyncService::CLEAR_NOT_STARTED : 294 profile_->GetProfileSyncService()->ResetClearServerDataState();
295 sync_service_->GetClearServerDataState();
Avi (use Gerrit) 2010/10/15 20:28:56 This was a reverse-merge conflict due to the fact
296 295
297 if (NULL != sync_service_) { 296 if (NULL != sync_service_) {
298 sync_service_->ResetClearServerDataState(); 297 sync_service_->ResetClearServerDataState();
299 } 298 }
300 299
301 switch (clear_state) { 300 switch (clear_state) {
302 case ProfileSyncService::CLEAR_NOT_STARTED: 301 case ProfileSyncService::CLEAR_NOT_STARTED:
303 // This can occur on a first start and after a failed clear (which does 302 // We can get here when we first start and after a failed clear (which
304 // not close the tab). Do nothing. 303 // does not close the tab), do nothing.
305 break; 304 break;
306 case ProfileSyncService::CLEAR_CLEARING: 305 case ProfileSyncService::CLEAR_CLEARING:
307 // Clearing buttons on all tabs are disabled at this point, throbber is 306 // Clearing buttons on all tabs are disabled at this
308 // going. 307 // point, throbber is going
309 status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_SENDING)); 308 status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_SENDING));
310 status_label_->SetVisible(true); 309 status_label_->SetVisible(true);
311 delete_in_progress = true; 310 delete_in_progress = true;
312 break; 311 break;
313 case ProfileSyncService::CLEAR_FAILED: 312 case ProfileSyncService::CLEAR_FAILED:
314 // Show an error and reallow clearing. 313 // Show an error and reallow clearing
315 clear_data_parent_window_->FailedClearingServerData(); 314 clear_data_parent_window_->FailedClearingServerData();
316 status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_ERROR)); 315 status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_ERROR));
317 status_label_->SetVisible(true); 316 status_label_->SetVisible(true);
318 delete_in_progress = false; 317 delete_in_progress = false;
319 break; 318 break;
320 case ProfileSyncService::CLEAR_SUCCEEDED: 319 case ProfileSyncService::CLEAR_SUCCEEDED:
321 // Close the dialog box, success! 320 // Close the dialog box, success!
322 status_label_->SetVisible(false); 321 status_label_->SetVisible(false);
323 delete_in_progress = false; 322 delete_in_progress = false;
324 clear_data_parent_window_->SucceededClearingServerData(); 323 clear_data_parent_window_->SucceededClearingServerData();
325 break; 324 break;
326 } 325 }
327 326
328 // allow_clear can be false when a local browsing data clear is happening 327 // allow_clear can be false when a local browsing data clear is happening
329 // from the neighboring tab. delete_in_progress means that a clear is 328 // from the neighboring tab. delete_in_progress means that a clear is
330 // pending in the current tab. 329 // pending in the current tab.
331 UpdateClearButtonEnabledState(delete_in_progress); 330 UpdateClearButtonEnabledState(delete_in_progress);
332 331
333 throbber_->SetVisible(delete_in_progress); 332 throbber_->SetVisible(delete_in_progress);
334 if (delete_in_progress) 333 if (delete_in_progress)
335 throbber_->Start(); 334 throbber_->Start();
336 else 335 else
337 throbber_->Stop(); 336 throbber_->Stop();
338 } 337 }
339 338
340 void ClearServerDataView::UpdateClearButtonEnabledState( 339 void ClearServerDataView::UpdateClearButtonEnabledState(
341 bool delete_in_progress) { 340 bool delete_in_progress) {
342 this->clear_server_data_button_->SetEnabled( 341 this->clear_server_data_button_->SetEnabled(
343 sync_service_ != NULL && 342 sync_service_ != NULL &&
344 sync_service_->HasSyncSetupCompleted() && 343 sync_service_->HasSyncSetupCompleted() &&
345 !delete_in_progress && allow_clear_); 344 !delete_in_progress && allow_clear_);
346 } 345 }
347 346
OLDNEW
« no previous file with comments | « chrome/browser/views/clear_server_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698