| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/views/uninstall_dialog.h" |
| 6 |
| 7 #include "base/message_loop.h" |
| 8 #include "chrome/common/l10n_util.h" |
| 9 #include "chrome/common/result_codes.h" |
| 10 #include "chrome/common/message_box_flags.h" |
| 11 #include "chrome/views/controls/message_box_view.h" |
| 12 #include "chrome/views/window/window.h" |
| 13 #include "grit/chromium_strings.h" |
| 14 |
| 15 // static |
| 16 void UninstallDialog::ShowUninstallDialog(int& user_selection) { |
| 17 // When the window closes, it will delete itself. |
| 18 new UninstallDialog(user_selection); |
| 19 } |
| 20 |
| 21 bool UninstallDialog::Accept() { |
| 22 user_selection_ = ResultCodes::NORMAL_EXIT; |
| 23 if (message_box_view_->IsCheckBoxSelected()) |
| 24 user_selection_ = ResultCodes::UNINSTALL_DELETE_PROFILE; |
| 25 return true; |
| 26 } |
| 27 |
| 28 bool UninstallDialog::Cancel() { |
| 29 user_selection_ = ResultCodes::UNINSTALL_USER_CANCEL; |
| 30 return true; |
| 31 } |
| 32 |
| 33 int UninstallDialog::GetDialogButtons() const { |
| 34 return DIALOGBUTTON_OK | DIALOGBUTTON_CANCEL; |
| 35 } |
| 36 |
| 37 std::wstring UninstallDialog::GetWindowTitle() const { |
| 38 return l10n_util::GetString(IDS_UNINSTALL_CHROME); |
| 39 } |
| 40 |
| 41 void UninstallDialog::DeleteDelegate() { |
| 42 delete this; |
| 43 } |
| 44 |
| 45 views::View* UninstallDialog::GetContentsView() { |
| 46 return message_box_view_; |
| 47 } |
| 48 |
| 49 UninstallDialog::UninstallDialog(int& user_selection) |
| 50 : user_selection_(user_selection) { |
| 51 // Also deleted when the window closes. |
| 52 message_box_view_ = new MessageBoxView( |
| 53 MessageBox::kIsConfirmMessageBox | MessageBox::kAutoDetectAlignment, |
| 54 l10n_util::GetString(IDS_UNINSTALL_VERIFY).c_str(), |
| 55 std::wstring()); |
| 56 message_box_view_->SetCheckBoxLabel( |
| 57 l10n_util::GetString(IDS_UNINSTALL_DELETE_PROFILE)); |
| 58 message_box_view_->SetCheckBoxSelected(false); |
| 59 views::Window::CreateChromeWindow(NULL, gfx::Rect(), this)->Show(); |
| 60 } |
| 61 |
| 62 UninstallDialog::~UninstallDialog() { |
| 63 MessageLoop::current()->Quit(); |
| 64 } |
| 65 |
| 66 |
| OLD | NEW |