| 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/webui/options/chromeos/about_page_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/about_page_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/callback_old.h" | |
| 13 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 14 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 15 #include "base/string16.h" | 14 #include "base/string16.h" |
| 16 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 17 #include "base/time.h" | 16 #include "base/time.h" |
| 18 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 19 #include "base/values.h" | 18 #include "base/values.h" |
| 20 #include "chrome/browser/chromeos/cros/cros_library.h" | 19 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 21 #include "chrome/browser/chromeos/cros/power_library.h" | 20 #include "chrome/browser/chromeos/cros/power_library.h" |
| 22 #include "chrome/browser/chromeos/cros/update_library.h" | 21 #include "chrome/browser/chromeos/cros/update_library.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 241 |
| 243 web_ui_->RegisterMessageCallback("CheckNow", | 242 web_ui_->RegisterMessageCallback("CheckNow", |
| 244 base::Bind(&AboutPageHandler::CheckNow, base::Unretained(this))); | 243 base::Bind(&AboutPageHandler::CheckNow, base::Unretained(this))); |
| 245 web_ui_->RegisterMessageCallback("RestartNow", | 244 web_ui_->RegisterMessageCallback("RestartNow", |
| 246 base::Bind(&AboutPageHandler::RestartNow, base::Unretained(this))); | 245 base::Bind(&AboutPageHandler::RestartNow, base::Unretained(this))); |
| 247 } | 246 } |
| 248 | 247 |
| 249 void AboutPageHandler::PageReady(const ListValue* args) { | 248 void AboutPageHandler::PageReady(const ListValue* args) { |
| 250 // Version information is loaded from a callback | 249 // Version information is loaded from a callback |
| 251 loader_.GetVersion(&consumer_, | 250 loader_.GetVersion(&consumer_, |
| 252 NewCallback(this, &AboutPageHandler::OnOSVersion), | 251 base::Bind(&AboutPageHandler::OnOSVersion, |
| 252 base::Unretained(this)), |
| 253 VersionLoader::VERSION_FULL); | 253 VersionLoader::VERSION_FULL); |
| 254 loader_.GetFirmware(&consumer_, | 254 loader_.GetFirmware(&consumer_, |
| 255 NewCallback(this, &AboutPageHandler::OnOSFirmware)); | 255 base::Bind(&AboutPageHandler::OnOSFirmware, |
| 256 base::Unretained(this))); |
| 256 | 257 |
| 257 UpdateLibrary* update_library = | 258 UpdateLibrary* update_library = |
| 258 CrosLibrary::Get()->GetUpdateLibrary(); | 259 CrosLibrary::Get()->GetUpdateLibrary(); |
| 259 | 260 |
| 260 update_observer_.reset(new UpdateObserver(this)); | 261 update_observer_.reset(new UpdateObserver(this)); |
| 261 update_library->AddObserver(update_observer_.get()); | 262 update_library->AddObserver(update_observer_.get()); |
| 262 | 263 |
| 263 // Update the WebUI page with the current status. See comments below. | 264 // Update the WebUI page with the current status. See comments below. |
| 264 UpdateStatus(update_library->status()); | 265 UpdateStatus(update_library->status()); |
| 265 | 266 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 if (CrosLibrary::Get()->GetUpdateLibrary()->HasObserver(observer)) { | 414 if (CrosLibrary::Get()->GetUpdateLibrary()->HasObserver(observer)) { |
| 414 // If UpdateLibrary still has the observer, then the page handler is valid. | 415 // If UpdateLibrary still has the observer, then the page handler is valid. |
| 415 AboutPageHandler* handler = observer->page_handler(); | 416 AboutPageHandler* handler = observer->page_handler(); |
| 416 scoped_ptr<Value> channel_string(Value::CreateStringValue(channel)); | 417 scoped_ptr<Value> channel_string(Value::CreateStringValue(channel)); |
| 417 handler->web_ui_->CallJavascriptFunction( | 418 handler->web_ui_->CallJavascriptFunction( |
| 418 "AboutPage.updateSelectedOptionCallback", *channel_string); | 419 "AboutPage.updateSelectedOptionCallback", *channel_string); |
| 419 } | 420 } |
| 420 } | 421 } |
| 421 | 422 |
| 422 } // namespace chromeos | 423 } // namespace chromeos |
| OLD | NEW |