| 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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/views/window.h" | 10 #include "chrome/browser/ui/views/window.h" |
| 11 #include "grit/chromium_strings.h" | 11 #include "grit/chromium_strings.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/message_box_flags.h" | 14 #include "ui/base/message_box_flags.h" |
| 15 #include "views/controls/message_box_view.h" | 15 #include "views/controls/message_box_view.h" |
| 16 #include "views/widget/widget.h" | 16 #include "views/widget/widget.h" |
| 17 | 17 |
| 18 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
| 19 #include "chrome/browser/chromeos/cros/cros_library.h" | 19 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 20 #include "chrome/browser/chromeos/cros/power_library.h" | 20 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
| 24 // UpdateRecommendedMessageBox, public: | 25 // UpdateRecommendedMessageBox, public: |
| 25 | 26 |
| 26 // static | 27 // static |
| 27 void UpdateRecommendedMessageBox::ShowMessageBox( | 28 void UpdateRecommendedMessageBox::ShowMessageBox( |
| 28 gfx::NativeWindow parent_window) { | 29 gfx::NativeWindow parent_window) { |
| 29 // When the window closes, it will delete itself. | 30 // When the window closes, it will delete itself. |
| 30 new UpdateRecommendedMessageBox(parent_window); | 31 new UpdateRecommendedMessageBox(parent_window); |
| 31 } | 32 } |
| 32 | 33 |
| 33 bool UpdateRecommendedMessageBox::Accept() { | 34 bool UpdateRecommendedMessageBox::Accept() { |
| 34 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 35 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RequestRestart(); | 36 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 36 // If running the Chrome OS build, but we're not on the device, fall through | 37 // If running the Chrome OS build, but we're not on the device, fall through |
| 37 #endif | 38 #endif |
| 38 BrowserList::AttemptRestart(); | 39 BrowserList::AttemptRestart(); |
| 39 return true; | 40 return true; |
| 40 } | 41 } |
| 41 | 42 |
| 42 int UpdateRecommendedMessageBox::GetDialogButtons() const { | 43 int UpdateRecommendedMessageBox::GetDialogButtons() const { |
| 43 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 44 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
| 44 } | 45 } |
| 45 | 46 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 ui::MessageBoxFlags::kFlagHasMessage | | 101 ui::MessageBoxFlags::kFlagHasMessage | |
| 101 ui::MessageBoxFlags::kFlagHasOKButton, | 102 ui::MessageBoxFlags::kFlagHasOKButton, |
| 102 l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED, product_name), | 103 l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED, product_name), |
| 103 string16(), | 104 string16(), |
| 104 kDialogWidth); | 105 kDialogWidth); |
| 105 browser::CreateViewsWindow(parent_window, this)->Show(); | 106 browser::CreateViewsWindow(parent_window, this)->Show(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() { | 109 UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() { |
| 109 } | 110 } |
| OLD | NEW |