| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/update_recommended_message_box.h" | 5 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/message_box_flags.h" | |
| 9 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
| 11 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/ui/views/window.h" | 12 #include "chrome/browser/ui/views/window.h" |
| 14 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 15 #include "grit/chromium_strings.h" | 14 #include "grit/chromium_strings.h" |
| 16 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 16 #include "ui/base/message_box_flags.h" |
| 17 #include "views/controls/message_box_view.h" | 17 #include "views/controls/message_box_view.h" |
| 18 #include "views/window/window.h" | 18 #include "views/window/window.h" |
| 19 | 19 |
| 20 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
| 21 #include "chrome/browser/chromeos/cros/cros_library.h" | 21 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 22 #include "chrome/browser/chromeos/cros/power_library.h" | 22 #include "chrome/browser/chromeos/cros/power_library.h" |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 //////////////////////////////////////////////////////////////////////////////// | 25 //////////////////////////////////////////////////////////////////////////////// |
| 26 // UpdateRecommendedMessageBox, public: | 26 // UpdateRecommendedMessageBox, public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 40 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 41 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RequestRestart(); | 41 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RequestRestart(); |
| 42 // If running the Chrome OS build, but we're not on the device, fall through | 42 // If running the Chrome OS build, but we're not on the device, fall through |
| 43 #endif | 43 #endif |
| 44 BrowserList::CloseAllBrowsersAndExit(); | 44 BrowserList::CloseAllBrowsersAndExit(); |
| 45 | 45 |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 int UpdateRecommendedMessageBox::GetDialogButtons() const { | 49 int UpdateRecommendedMessageBox::GetDialogButtons() const { |
| 50 return MessageBoxFlags::DIALOGBUTTON_OK | | 50 return ui::MessageBoxFlags::DIALOGBUTTON_OK | |
| 51 MessageBoxFlags::DIALOGBUTTON_CANCEL; | 51 ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; |
| 52 } | 52 } |
| 53 | 53 |
| 54 std::wstring UpdateRecommendedMessageBox::GetDialogButtonLabel( | 54 std::wstring UpdateRecommendedMessageBox::GetDialogButtonLabel( |
| 55 MessageBoxFlags::DialogButton button) const { | 55 ui::MessageBoxFlags::DialogButton button) const { |
| 56 DCHECK(button == MessageBoxFlags::DIALOGBUTTON_OK || | 56 DCHECK(button == ui::MessageBoxFlags::DIALOGBUTTON_OK || |
| 57 button == MessageBoxFlags::DIALOGBUTTON_CANCEL); | 57 button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL); |
| 58 return button == MessageBoxFlags::DIALOGBUTTON_OK ? | 58 return button == ui::MessageBoxFlags::DIALOGBUTTON_OK ? |
| 59 UTF16ToWide(l10n_util::GetStringUTF16(IDS_RESTART_AND_UPDATE)) : | 59 UTF16ToWide(l10n_util::GetStringUTF16(IDS_RESTART_AND_UPDATE)) : |
| 60 UTF16ToWide(l10n_util::GetStringUTF16(IDS_NOT_NOW)); | 60 UTF16ToWide(l10n_util::GetStringUTF16(IDS_NOT_NOW)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 std::wstring UpdateRecommendedMessageBox::GetWindowTitle() const { | 63 std::wstring UpdateRecommendedMessageBox::GetWindowTitle() const { |
| 64 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 64 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void UpdateRecommendedMessageBox::DeleteDelegate() { | 67 void UpdateRecommendedMessageBox::DeleteDelegate() { |
| 68 delete this; | 68 delete this; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 83 gfx::NativeWindow parent_window) { | 83 gfx::NativeWindow parent_window) { |
| 84 const int kDialogWidth = 400; | 84 const int kDialogWidth = 400; |
| 85 #if defined(OS_CHROMEOS) | 85 #if defined(OS_CHROMEOS) |
| 86 const int kProductNameId = IDS_PRODUCT_OS_NAME; | 86 const int kProductNameId = IDS_PRODUCT_OS_NAME; |
| 87 #else | 87 #else |
| 88 const int kProductNameId = IDS_PRODUCT_NAME; | 88 const int kProductNameId = IDS_PRODUCT_NAME; |
| 89 #endif | 89 #endif |
| 90 const string16 product_name = l10n_util::GetStringUTF16(kProductNameId); | 90 const string16 product_name = l10n_util::GetStringUTF16(kProductNameId); |
| 91 // Also deleted when the window closes. | 91 // Also deleted when the window closes. |
| 92 message_box_view_ = new MessageBoxView( | 92 message_box_view_ = new MessageBoxView( |
| 93 MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton, | 93 ui::MessageBoxFlags::kFlagHasMessage | |
| 94 ui::MessageBoxFlags::kFlagHasOKButton, |
| 94 UTF16ToWide(l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED, | 95 UTF16ToWide(l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED, |
| 95 product_name)), | 96 product_name)), |
| 96 std::wstring(), | 97 std::wstring(), |
| 97 kDialogWidth); | 98 kDialogWidth); |
| 98 browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show(); | 99 browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show(); |
| 99 } | 100 } |
| 100 | 101 |
| 101 UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() { | 102 UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() { |
| 102 } | 103 } |
| OLD | NEW |