summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd15
-rw-r--r--chrome/browser/dom_ui/options/about_page_handler.cc12
-rw-r--r--chrome/browser/dom_ui/options/about_page_handler.h5
-rw-r--r--chrome/browser/resources/options/about_page.js13
-rw-r--r--chrome/browser/views/frame/browser_view.cc2
-rw-r--r--chrome/browser/views/update_recommended_message_box.cc20
-rw-r--r--chrome/browser/wrench_menu_model.cc22
-rw-r--r--chrome/chrome_browser.gypi2
8 files changed, 79 insertions, 12 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 6632245..8b2af54 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8644,9 +8644,16 @@ Keep your key file in a safe place. You will need it to create new versions of y
</message>
<!-- Update Recommended dialog -->
- <message name="IDS_UPDATE_RECOMMENDED" desc="The main text of the Update Recommended dialog.">
- <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is out of date because it hasn't been restarted in a while. An update is available and will be applied as soon as you restart.
- </message>
+ <if expr="not pp_ifdef('chromeos')">
+ <message name="IDS_UPDATE_RECOMMENDED" desc="The main text of the Update Recommended dialog.">
+ <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is out of date because it hasn't been restarted in a while. An update is available and will be applied as soon as you restart.
+ </message>
+ </if>
+ <if expr="pp_ifdef('chromeos')">
+ <message name="IDS_UPDATE_RECOMMENDED" desc="The main text of the Update Recommended dialog.">
+ <ph name="PRODUCT_NAME">$1<ex>Google Chrome OS</ex></ph> needs to be restarted to apply the update.
+ </message>
+ </if>
<message name="IDS_RESTART_AND_UPDATE" desc="The button label for restarting and updating Chrome.">
Restart
</message>
@@ -8889,7 +8896,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
Finalizing system update&#x2026;
</message>
<message name="IDS_UPDATE_COMPLETED" desc="Notification for update completed">
- System update complete. Please restart the system by pressing the power button, wait for the system to power down, then press the power button again.
+ System update complete. Please restart the system.
</message>
<message name="IDS_INSTALLING_UPDATE" desc="Label shown on the updates installation screen during OOBE">
Please wait while <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> installs the latest system updates.
diff --git a/chrome/browser/dom_ui/options/about_page_handler.cc b/chrome/browser/dom_ui/options/about_page_handler.cc
index cece7a3..902e71a 100644
--- a/chrome/browser/dom_ui/options/about_page_handler.cc
+++ b/chrome/browser/dom_ui/options/about_page_handler.cc
@@ -33,6 +33,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/power_library.h"
#include "chrome/browser/chromeos/cros/update_library.h"
#endif
@@ -66,6 +67,7 @@ const LocalizeEntry localize_table[] = {
{ "loading", IDS_ABOUT_PAGE_LOADING },
{ "check_now", IDS_ABOUT_PAGE_CHECK_NOW },
{ "update_status", IDS_UPGRADE_CHECK_STARTED },
+ { "restart_now", IDS_RESTART_AND_UPDATE },
#else
{ "product", IDS_PRODUCT_NAME },
{ "check_now", IDS_ABOUT_CHROME_UPDATE_CHECK },
@@ -239,6 +241,8 @@ void AboutPageHandler::RegisterMessages() {
#if defined(OS_CHROMEOS)
dom_ui_->RegisterMessageCallback("CheckNow",
NewCallback(this, &AboutPageHandler::CheckNow));
+ dom_ui_->RegisterMessageCallback("RestartNow",
+ NewCallback(this, &AboutPageHandler::RestartNow));
#endif
}
@@ -272,6 +276,10 @@ void AboutPageHandler::CheckNow(const ListValue* args) {
chromeos::InitiateUpdateCheck();
}
+void AboutPageHandler::RestartNow(const ListValue* args) {
+ chromeos::CrosLibrary::Get()->GetPowerLibrary()->RequestRestart();
+}
+
void AboutPageHandler::UpdateStatus(
const chromeos::UpdateLibrary::Status& status) {
string16 message;
@@ -347,6 +355,10 @@ void AboutPageHandler::UpdateStatus(
dom_ui_->CallJavascriptFunction(L"AboutPage.setUpdateImage",
*image_string);
}
+ // We'll change the "Check For Update" button to "Restart" button.
+ if (status.status == chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) {
+ dom_ui_->CallJavascriptFunction(L"AboutPage.changeToRestartButton");
+ }
}
void AboutPageHandler::OnOSVersion(chromeos::VersionLoader::Handle handle,
diff --git a/chrome/browser/dom_ui/options/about_page_handler.h b/chrome/browser/dom_ui/options/about_page_handler.h
index 2e4a760..cd10052 100644
--- a/chrome/browser/dom_ui/options/about_page_handler.h
+++ b/chrome/browser/dom_ui/options/about_page_handler.h
@@ -29,7 +29,12 @@ class AboutPageHandler : public OptionsPageUIHandler {
void PageReady(const ListValue* args);
#if defined(OS_CHROMEOS)
+ // Initiates update check.
void CheckNow(const ListValue* args);
+
+ // Restarts the system.
+ void RestartNow(const ListValue* args);
+
// Callback from chromeos::VersionLoader giving the version.
void OnOSVersion(chromeos::VersionLoader::Handle handle,
std::string version);
diff --git a/chrome/browser/resources/options/about_page.js b/chrome/browser/resources/options/about_page.js
index a6490a3..9d2c126 100644
--- a/chrome/browser/resources/options/about_page.js
+++ b/chrome/browser/resources/options/about_page.js
@@ -49,6 +49,15 @@ cr.define('options', function() {
updateEnable_: function(enable) {
$('checkNow').disabled = !enable;
},
+
+ // Changes the "check now" button to "restart now" button.
+ changeToRestartButton_: function() {
+ $('checkNow').textContent = localStrings.getString('restart_now');
+ $('checkNow').disabled = false;
+ $('checkNow').onclick = function(event) {
+ chrome.send('RestartNow');
+ };
+ },
};
AboutPage.updateOSVersionCallback = function(versionString) {
@@ -67,6 +76,10 @@ cr.define('options', function() {
$('updateIcon').className= 'update-icon ' + state;
};
+ AboutPage.changeToRestartButton = function() {
+ AboutPage.getInstance().changeToRestartButton_();
+ };
+
// Export
return {
AboutPage: AboutPage
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index b09242b..bc77707 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1068,9 +1068,7 @@ views::Window* BrowserView::ShowAboutChromeDialog() {
}
void BrowserView::ShowUpdateChromeDialog() {
-#if defined(OS_WIN)
UpdateRecommendedMessageBox::ShowMessageBox(GetWindow()->GetNativeWindow());
-#endif
}
void BrowserView::ShowTaskManager() {
diff --git a/chrome/browser/views/update_recommended_message_box.cc b/chrome/browser/views/update_recommended_message_box.cc
index 99ecbbd..baf69ab 100644
--- a/chrome/browser/views/update_recommended_message_box.cc
+++ b/chrome/browser/views/update_recommended_message_box.cc
@@ -9,12 +9,18 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/views/window.h"
#include "chrome/common/pref_names.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "views/controls/message_box_view.h"
#include "views/window/window.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/power_library.h"
+#endif
+
////////////////////////////////////////////////////////////////////////////////
// UpdateRecommendedMessageBox, public:
@@ -30,6 +36,10 @@ bool UpdateRecommendedMessageBox::Accept() {
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true);
+#if defined(OS_CHROMEOS)
+ chromeos::CrosLibrary::Get()->GetPowerLibrary()->RequestRestart();
+ // If running the Chrome OS build, but we're not on the device, fall through
+#endif
BrowserList::CloseAllBrowsersAndExit();
return true;
@@ -71,14 +81,18 @@ views::View* UpdateRecommendedMessageBox::GetContentsView() {
UpdateRecommendedMessageBox::UpdateRecommendedMessageBox(
gfx::NativeWindow parent_window) {
const int kDialogWidth = 400;
+#if defined(OS_CHROMEOS)
+ const std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_OS_NAME);
+#else
+ const std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_NAME);
+#endif
// Also deleted when the window closes.
message_box_view_ = new MessageBoxView(
MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton,
- l10n_util::GetStringF(IDS_UPDATE_RECOMMENDED,
- l10n_util::GetString(IDS_PRODUCT_NAME)),
+ l10n_util::GetStringF(IDS_UPDATE_RECOMMENDED, product_name),
std::wstring(),
kDialogWidth);
- views::Window::CreateChromeWindow(parent_window, gfx::Rect(), this)->Show();
+ browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show();
}
UpdateRecommendedMessageBox::~UpdateRecommendedMessageBox() {
diff --git a/chrome/browser/wrench_menu_model.cc b/chrome/browser/wrench_menu_model.cc
index d308a4d..8b77a4e 100644
--- a/chrome/browser/wrench_menu_model.cc
+++ b/chrome/browser/wrench_menu_model.cc
@@ -44,6 +44,11 @@
#include "chrome/browser/browser_window.h"
#endif
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/update_library.h"
+#endif
+
////////////////////////////////////////////////////////////////////////////////
// EncodingMenuModel
@@ -258,8 +263,14 @@ bool WrenchMenuModel::IsCommandIdEnabled(int command_id) const {
}
bool WrenchMenuModel::IsCommandIdVisible(int command_id) const {
- if (command_id == IDC_UPGRADE_DIALOG)
+ if (command_id == IDC_UPGRADE_DIALOG) {
+#if defined(OS_CHROMEOS)
+ return (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->status().status
+ == chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT);
+#else
return Singleton<UpgradeDetector>::get()->notify_upgrade();
+#endif
+ }
return true;
}
@@ -383,14 +394,19 @@ void WrenchMenuModel::Build() {
#endif
}
+#if defined(OS_CHROMEOS)
+ const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME);
+#else
+ const string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
+#endif
// On Mac, there is no About item.
if (browser_defaults::kShowAboutMenuItem) {
AddItem(IDC_ABOUT, l10n_util::GetStringFUTF16(
- IDS_ABOUT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ IDS_ABOUT, product_name));
}
AddItem(IDC_UPGRADE_DIALOG, l10n_util::GetStringFUTF16(
- IDS_UPDATE_NOW, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ IDS_UPDATE_NOW, product_name));
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SetIcon(GetIndexOfCommandId(IDC_UPGRADE_DIALOG),
*rb.GetBitmapNamed(IDR_UPDATE_AVAILABLE));
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 082834d..e9088e4 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3882,6 +3882,8 @@
['include', '^browser/views/toolbar_view.h'],
['include', '^browser/views/unhandled_keyboard_event_handler.cc'],
['include', '^browser/views/unhandled_keyboard_event_handler.h'],
+ ['include', '^browser/views/update_recommended_message_box.h'],
+ ['include', '^browser/views/update_recommended_message_box.cc'],
['include', '^browser/views/view_text_utils.cc'],
['include', '^browser/views/view_text_utils.h'],
['include', '^browser/views/window.cc'],