| 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 "app/l10n_util.h" | |
| 8 #include "app/message_box_flags.h" | |
| 9 #include "base/message_loop.h" | |
| 10 #include "chrome/common/result_codes.h" | |
| 11 #include "grit/chromium_strings.h" | |
| 12 #include "views/controls/message_box_view.h" | |
| 13 #include "views/window/window.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 std::wstring UninstallDialog::GetWindowTitle() const { | |
| 34 return l10n_util::GetString(IDS_UNINSTALL_CHROME); | |
| 35 } | |
| 36 | |
| 37 void UninstallDialog::DeleteDelegate() { | |
| 38 delete this; | |
| 39 } | |
| 40 | |
| 41 views::View* UninstallDialog::GetContentsView() { | |
| 42 return message_box_view_; | |
| 43 } | |
| 44 | |
| 45 UninstallDialog::UninstallDialog(int& user_selection) | |
| 46 : user_selection_(user_selection) { | |
| 47 // Also deleted when the window closes. | |
| 48 message_box_view_ = new MessageBoxView( | |
| 49 MessageBoxFlags::kIsConfirmMessageBox | | |
| 50 MessageBoxFlags::kAutoDetectAlignment, | |
| 51 l10n_util::GetString(IDS_UNINSTALL_VERIFY).c_str(), | |
| 52 std::wstring()); | |
| 53 message_box_view_->SetCheckBoxLabel( | |
| 54 l10n_util::GetString(IDS_UNINSTALL_DELETE_PROFILE)); | |
| 55 message_box_view_->SetCheckBoxSelected(false); | |
| 56 views::Window::CreateChromeWindow(NULL, gfx::Rect(), this)->Show(); | |
| 57 } | |
| 58 | |
| 59 UninstallDialog::~UninstallDialog() { | |
| 60 MessageLoop::current()->Quit(); | |
| 61 } | |
| OLD | NEW |