diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 13:24:57 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 13:24:57 +0000 |
commit | 4df8786fcd6334d4f5f92350a8297135149aabae (patch) | |
tree | c373e3afb8ec9104547ee873019ce0be920b14a5 /chrome/browser/views | |
parent | 7d280cb1adf9c8e66ef8f9c97e8b633b0eac37e0 (diff) | |
download | chromium_src-4df8786fcd6334d4f5f92350a8297135149aabae.zip chromium_src-4df8786fcd6334d4f5f92350a8297135149aabae.tar.gz chromium_src-4df8786fcd6334d4f5f92350a8297135149aabae.tar.bz2 |
On uninstall ask whether to delete profile.
BUG=8431
Review URL: http://codereview.chromium.org/62097
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/browser_views.vcproj | 8 | ||||
-rw-r--r-- | chrome/browser/views/uninstall_dialog.cc | 66 | ||||
-rw-r--r-- | chrome/browser/views/uninstall_dialog.h | 40 |
3 files changed, 114 insertions, 0 deletions
diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj index 6905db1..a923afa 100644 --- a/chrome/browser/views/browser_views.vcproj +++ b/chrome/browser/views/browser_views.vcproj @@ -858,6 +858,14 @@ > </File> <File + RelativePath=".\uninstall_dialog.cc" + > + </File> + <File + RelativePath=".\uninstall_dialog.h" + > + </File> + <File RelativePath=".\user_data_dir_dialog.cc" > </File> diff --git a/chrome/browser/views/uninstall_dialog.cc b/chrome/browser/views/uninstall_dialog.cc new file mode 100644 index 0000000..da54ca8 --- /dev/null +++ b/chrome/browser/views/uninstall_dialog.cc @@ -0,0 +1,66 @@ +// Copyright (c) 2009 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. + +#include "chrome/browser/views/uninstall_dialog.h" + +#include "base/message_loop.h" +#include "chrome/common/l10n_util.h" +#include "chrome/common/result_codes.h" +#include "chrome/common/message_box_flags.h" +#include "chrome/views/controls/message_box_view.h" +#include "chrome/views/window/window.h" +#include "grit/chromium_strings.h" + +// static +void UninstallDialog::ShowUninstallDialog(int& user_selection) { + // When the window closes, it will delete itself. + new UninstallDialog(user_selection); +} + +bool UninstallDialog::Accept() { + user_selection_ = ResultCodes::NORMAL_EXIT; + if (message_box_view_->IsCheckBoxSelected()) + user_selection_ = ResultCodes::UNINSTALL_DELETE_PROFILE; + return true; +} + +bool UninstallDialog::Cancel() { + user_selection_ = ResultCodes::UNINSTALL_USER_CANCEL; + return true; +} + +int UninstallDialog::GetDialogButtons() const { + return DIALOGBUTTON_OK | DIALOGBUTTON_CANCEL; +} + +std::wstring UninstallDialog::GetWindowTitle() const { + return l10n_util::GetString(IDS_UNINSTALL_CHROME); +} + +void UninstallDialog::DeleteDelegate() { + delete this; +} + +views::View* UninstallDialog::GetContentsView() { + return message_box_view_; +} + +UninstallDialog::UninstallDialog(int& user_selection) + : user_selection_(user_selection) { + // Also deleted when the window closes. + message_box_view_ = new MessageBoxView( + MessageBox::kIsConfirmMessageBox | MessageBox::kAutoDetectAlignment, + l10n_util::GetString(IDS_UNINSTALL_VERIFY).c_str(), + std::wstring()); + message_box_view_->SetCheckBoxLabel( + l10n_util::GetString(IDS_UNINSTALL_DELETE_PROFILE)); + message_box_view_->SetCheckBoxSelected(false); + views::Window::CreateChromeWindow(NULL, gfx::Rect(), this)->Show(); +} + +UninstallDialog::~UninstallDialog() { + MessageLoop::current()->Quit(); +} + + diff --git a/chrome/browser/views/uninstall_dialog.h b/chrome/browser/views/uninstall_dialog.h new file mode 100644 index 0000000..0874db6 --- /dev/null +++ b/chrome/browser/views/uninstall_dialog.h @@ -0,0 +1,40 @@ +// Copyright (c) 2009 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_UNINSTALL_DIALOG_H_ +#define CHROME_BROWSER_VIEWS_UNINSTALL_DIALOG_H_ + +#include "base/basictypes.h" +#include "chrome/views/window/dialog_delegate.h" + +class MessageBoxView; + +// UninstallDialog implements the dialog that confirms Chrome uninstallation +// and asks whether to delete Chrome profile. +class UninstallDialog : public views::DialogDelegate { + public: + static void ShowUninstallDialog(int& user_selection); + + protected: + // Overridden from views::DialogDelegate: + virtual bool Accept(); + virtual bool Cancel(); + virtual int GetDialogButtons() const; + virtual std::wstring GetWindowTitle() const; + + // Overridden from views::WindowDelegate: + virtual void DeleteDelegate(); + virtual views::View* GetContentsView(); + + private: + explicit UninstallDialog(int& user_selection); + virtual ~UninstallDialog(); + + MessageBoxView* message_box_view_; + int& user_selection_; + + DISALLOW_COPY_AND_ASSIGN(UninstallDialog); +}; + +#endif // CHROME_BROWSER_VIEWS_UNINSTALL_DIALOG_H_ |