Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/browser/dom_ui/options/about_page_handler.cc

Issue 3858002: Show "Update Chrome OS" in the wrench menu, when the update image is ready. (Closed)
Patch Set: bubble Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/options/about_page_handler.h" 5 #include "chrome/browser/dom_ui/options/about_page_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 15 matching lines...) Expand all
26 #include "grit/locale_settings.h" 26 #include "grit/locale_settings.h"
27 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
28 #include "webkit/glue/webkit_glue.h" 28 #include "webkit/glue/webkit_glue.h"
29 29
30 #if defined(CHROME_V8) 30 #if defined(CHROME_V8)
31 #include "v8/include/v8.h" 31 #include "v8/include/v8.h"
32 #endif 32 #endif
33 33
34 #if defined(OS_CHROMEOS) 34 #if defined(OS_CHROMEOS)
35 #include "chrome/browser/chromeos/cros/cros_library.h" 35 #include "chrome/browser/chromeos/cros/cros_library.h"
36 #include "chrome/browser/chromeos/cros/power_library.h"
36 #include "chrome/browser/chromeos/cros/update_library.h" 37 #include "chrome/browser/chromeos/cros/update_library.h"
37 #endif 38 #endif
38 39
39 namespace { 40 namespace {
40 41
41 // These are used as placeholder text around the links in the text in the 42 // These are used as placeholder text around the links in the text in the
42 // license. 43 // license.
43 const wchar_t kBeginLink[] = L"BEGIN_LINK"; 44 const wchar_t kBeginLink[] = L"BEGIN_LINK";
44 const wchar_t kEndLink[] = L"END_LINK"; 45 const wchar_t kEndLink[] = L"END_LINK";
45 const wchar_t kBeginLinkChr[] = L"BEGIN_LINK_CHR"; 46 const wchar_t kBeginLinkChr[] = L"BEGIN_LINK_CHR";
(...skipping 13 matching lines...) Expand all
59 int resource; 60 int resource;
60 }; 61 };
61 62
62 const LocalizeEntry localize_table[] = { 63 const LocalizeEntry localize_table[] = {
63 #if defined (OS_CHROMEOS) 64 #if defined (OS_CHROMEOS)
64 { "product", IDS_PRODUCT_OS_NAME }, 65 { "product", IDS_PRODUCT_OS_NAME },
65 { "os", IDS_PRODUCT_OS_NAME }, 66 { "os", IDS_PRODUCT_OS_NAME },
66 { "loading", IDS_ABOUT_PAGE_LOADING }, 67 { "loading", IDS_ABOUT_PAGE_LOADING },
67 { "check_now", IDS_ABOUT_PAGE_CHECK_NOW }, 68 { "check_now", IDS_ABOUT_PAGE_CHECK_NOW },
68 { "update_status", IDS_UPGRADE_CHECK_STARTED }, 69 { "update_status", IDS_UPGRADE_CHECK_STARTED },
70 { "restart_now", IDS_RESTART_AND_UPDATE },
69 #else 71 #else
70 { "product", IDS_PRODUCT_NAME }, 72 { "product", IDS_PRODUCT_NAME },
71 { "check_now", IDS_ABOUT_CHROME_UPDATE_CHECK }, 73 { "check_now", IDS_ABOUT_CHROME_UPDATE_CHECK },
72 #endif 74 #endif
73 { "browser", IDS_PRODUCT_NAME }, 75 { "browser", IDS_PRODUCT_NAME },
74 { "more_info", IDS_ABOUT_PAGE_MORE_INFO }, 76 { "more_info", IDS_ABOUT_PAGE_MORE_INFO },
75 { "copyright", IDS_ABOUT_VERSION_COPYRIGHT }, 77 { "copyright", IDS_ABOUT_VERSION_COPYRIGHT },
76 { "channel", IDS_ABOUT_PAGE_CHANNEL }, 78 { "channel", IDS_ABOUT_PAGE_CHANNEL },
77 { "release", IDS_ABOUT_PAGE_CHANNEL_RELEASE }, 79 { "release", IDS_ABOUT_PAGE_CHANNEL_RELEASE },
78 { "beta", IDS_ABOUT_PAGE_CHANNEL_BETA }, 80 { "beta", IDS_ABOUT_PAGE_CHANNEL_BETA },
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 #endif 234 #endif
233 } 235 }
234 236
235 void AboutPageHandler::RegisterMessages() { 237 void AboutPageHandler::RegisterMessages() {
236 dom_ui_->RegisterMessageCallback("PageReady", 238 dom_ui_->RegisterMessageCallback("PageReady",
237 NewCallback(this, &AboutPageHandler::PageReady)); 239 NewCallback(this, &AboutPageHandler::PageReady));
238 240
239 #if defined(OS_CHROMEOS) 241 #if defined(OS_CHROMEOS)
240 dom_ui_->RegisterMessageCallback("CheckNow", 242 dom_ui_->RegisterMessageCallback("CheckNow",
241 NewCallback(this, &AboutPageHandler::CheckNow)); 243 NewCallback(this, &AboutPageHandler::CheckNow));
244 dom_ui_->RegisterMessageCallback("RestartNow",
245 NewCallback(this, &AboutPageHandler::RestartNow));
242 #endif 246 #endif
243 } 247 }
244 248
245 void AboutPageHandler::PageReady(const ListValue* args) { 249 void AboutPageHandler::PageReady(const ListValue* args) {
246 #if defined(OS_CHROMEOS) 250 #if defined(OS_CHROMEOS)
247 // Version information is loaded from a callback 251 // Version information is loaded from a callback
248 loader_.GetVersion(&consumer_, 252 loader_.GetVersion(&consumer_,
249 NewCallback(this, &AboutPageHandler::OnOSVersion), 253 NewCallback(this, &AboutPageHandler::OnOSVersion),
250 true); 254 true);
251 255
(...skipping 13 matching lines...) Expand all
265 #endif 269 #endif
266 } 270 }
267 271
268 #if defined(OS_CHROMEOS) 272 #if defined(OS_CHROMEOS)
269 273
270 void AboutPageHandler::CheckNow(const ListValue* args) { 274 void AboutPageHandler::CheckNow(const ListValue* args) {
271 if (chromeos::InitiateUpdateCheck) 275 if (chromeos::InitiateUpdateCheck)
272 chromeos::InitiateUpdateCheck(); 276 chromeos::InitiateUpdateCheck();
273 } 277 }
274 278
279 void AboutPageHandler::RestartNow(const ListValue* args) {
280 chromeos::CrosLibrary::Get()->GetPowerLibrary()->RequestRestart();
281 }
282
275 void AboutPageHandler::UpdateStatus( 283 void AboutPageHandler::UpdateStatus(
276 const chromeos::UpdateLibrary::Status& status) { 284 const chromeos::UpdateLibrary::Status& status) {
277 string16 message; 285 string16 message;
278 std::string image = "up-to-date"; 286 std::string image = "up-to-date";
279 bool enabled = false; 287 bool enabled = false;
280 288
281 switch (status.status) { 289 switch (status.status) {
282 case chromeos::UPDATE_STATUS_IDLE: 290 case chromeos::UPDATE_STATUS_IDLE:
283 if (!sticky_) { 291 if (!sticky_) {
284 message = l10n_util::GetStringFUTF16(IDS_UPGRADE_ALREADY_UP_TO_DATE, 292 message = l10n_util::GetStringFUTF16(IDS_UPGRADE_ALREADY_UP_TO_DATE,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 *version_string); 348 *version_string);
341 349
342 scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled)); 350 scoped_ptr<Value> enabled_value(Value::CreateBooleanValue(enabled));
343 dom_ui_->CallJavascriptFunction(L"AboutPage.updateEnableCallback", 351 dom_ui_->CallJavascriptFunction(L"AboutPage.updateEnableCallback",
344 *enabled_value); 352 *enabled_value);
345 353
346 scoped_ptr<Value> image_string(Value::CreateStringValue(image)); 354 scoped_ptr<Value> image_string(Value::CreateStringValue(image));
347 dom_ui_->CallJavascriptFunction(L"AboutPage.setUpdateImage", 355 dom_ui_->CallJavascriptFunction(L"AboutPage.setUpdateImage",
348 *image_string); 356 *image_string);
349 } 357 }
358 // We'll change the "Check For Update" button to "Restart" button.
359 if (status.status == chromeos::UPDATE_STATUS_UPDATED_NEED_REBOOT) {
360 dom_ui_->CallJavascriptFunction(L"AboutPage.changeToRestartButton");
361 }
350 } 362 }
351 363
352 void AboutPageHandler::OnOSVersion(chromeos::VersionLoader::Handle handle, 364 void AboutPageHandler::OnOSVersion(chromeos::VersionLoader::Handle handle,
353 std::string version) { 365 std::string version) {
354 if (version.size()) { 366 if (version.size()) {
355 scoped_ptr<Value> version_string(Value::CreateStringValue(version)); 367 scoped_ptr<Value> version_string(Value::CreateStringValue(version));
356 dom_ui_->CallJavascriptFunction(L"AboutPage.updateOSVersionCallback", 368 dom_ui_->CallJavascriptFunction(L"AboutPage.updateOSVersionCallback",
357 *version_string); 369 *version_string);
358 } 370 }
359 } 371 }
360 #endif 372 #endif
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/about_page_handler.h ('k') | chrome/browser/resources/options/about_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698