diff options
author | raz@chromium.org <raz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 19:56:41 +0000 |
---|---|---|
committer | raz@chromium.org <raz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 19:56:41 +0000 |
commit | 689a7a717a5882405f935e7c18fdc47fcae9fadf (patch) | |
tree | b204a7cf394cc4054749d529758b627b6448e35f /chrome/browser/views/clear_data_view.h | |
parent | 3f5c1bba716c435264580010cd5c57f8830303b5 (diff) | |
download | chromium_src-689a7a717a5882405f935e7c18fdc47fcae9fadf.zip chromium_src-689a7a717a5882405f935e7c18fdc47fcae9fadf.tar.gz chromium_src-689a7a717a5882405f935e7c18fdc47fcae9fadf.tar.bz2 |
Added UI for clearing Chrome Sync data
- Created 2 tabs, one for for clearing local browsing data, one for clearing server data
- Refactored the old local browsing code to use a grid layout rather than less-wieldy math
- Controls on all tabs block while, closing dialog is disabled, new throbber is going while clear is in progress
- Clear server tab will be behind a flag until I deploy the server endpoint
- Retained old clearing behavior: dialog closes on successful lear
- Clear server UI only visible if user is syncing
Outstanding issues:
- Clearing currently causes an account to become unusable. The cause of the issue is a known problem with auth; currently investigating a fix
- Unlike local clearing, clearing server data is more likely to error out. For now I just show a label next to the clear button that says Error, allowing the user to try again
BUG=54349
TEST=Clear from UI, or run sync backend tests checked in for issue 54280
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=60845
Review URL: http://codereview.chromium.org/3412032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60980 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/clear_data_view.h')
-rw-r--r-- | chrome/browser/views/clear_data_view.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/chrome/browser/views/clear_data_view.h b/chrome/browser/views/clear_data_view.h new file mode 100644 index 0000000..9481ec4 --- /dev/null +++ b/chrome/browser/views/clear_data_view.h @@ -0,0 +1,99 @@ +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VIEWS_CLEAR_DATA_VIEW_H_ +#define CHROME_BROWSER_VIEWS_CLEAR_DATA_VIEW_H_ +#pragma once + +#include "app/combobox_model.h" +#include "chrome/browser/browsing_data_remover.h" +#include "chrome/browser/views/clear_browsing_data_view.h" +#include "chrome/browser/views/clear_server_data.h" +#include "views/controls/button/button.h" +#include "views/controls/combobox/combobox.h" +#include "views/controls/label.h" +#include "views/controls/link.h" +#include "views/controls/tabbed_pane/tabbed_pane.h" +#include "views/view.h" +#include "views/window/dialog_delegate.h" + +namespace views { +class Checkbox; +class Label; +class Throbber; +class Window; +} + +class ClearBrowsingDataView2; +class ClearServerDataView; +class Profile; +class MessageLoop; + +//////////////////////////////////////////////////////////////////////////////// +// +// The ClearDataView class is responsible for drawing the window that allows +// the user to select what to delete (history, downloads, etc). It has tabs +// separating "local" data from "other" (e.g. server) data +// +//////////////////////////////////////////////////////////////////////////////// +class ClearDataView : public views::View, + public views::DialogDelegate { + public: + explicit ClearDataView(Profile* profile); + virtual ~ClearDataView(void) {} + + // Disallow the window closing while clearing either server or browsing + // data. After clear completes, close the window. + void StartClearingBrowsingData(); + void StopClearingBrowsingData(); + + void StartClearingServerData(); + void SucceededClearingServerData(); + void FailedClearingServerData(); + + // Initialize the controls on the dialog. + void Init(); + + // Overridden from views::View: + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + + // Overridden from views::DialogDelegate: + virtual int GetDefaultDialogButton() const; + virtual std::wstring GetDialogButtonLabel( + MessageBoxFlags::DialogButton button) const; + virtual int GetDialogButtons() const; + virtual bool IsDialogButtonEnabled( + MessageBoxFlags::DialogButton button) const; + virtual bool CanResize() const; + virtual bool CanMaximize() const; + virtual bool IsAlwaysOnTop() const; + virtual bool HasAlwaysOnTopMenu() const; + virtual bool IsModal() const; + virtual std::wstring GetWindowTitle() const; + virtual views::View* GetContentsView(); + virtual bool GetSizeExtraViewHeightToButtons() { return true; } + virtual views::View* GetInitiallyFocusedView(); + + private: + // Sets the controls on the UI to be enabled/disabled depending on whether we + // have a delete operation in progress or not. + void UpdateControlEnabledState(); + + // Currently clearing + bool clearing_data_; + + views::TabbedPane* tabs_; + ClearServerDataView* clear_server_data_tab_; + ClearBrowsingDataView2* clear_browsing_data_tab_; + + Profile* profile_; + + DISALLOW_COPY_AND_ASSIGN(ClearDataView); +}; + +static const int kDialogPadding = 7; + +#endif // CHROME_BROWSER_VIEWS_CLEAR_DATA_VIEW_H_ + |