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" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 if (!UserManager::Get()->current_user_is_owner()) { | 283 if (!UserManager::Get()->current_user_is_owner()) { |
284 LOG(WARNING) << "Non-owner tried to change release track."; | 284 LOG(WARNING) << "Non-owner tried to change release track."; |
285 return; | 285 return; |
286 } | 286 } |
287 const std::string channel = UTF16ToUTF8(ExtractStringValue(args)); | 287 const std::string channel = UTF16ToUTF8(ExtractStringValue(args)); |
288 CrosLibrary::Get()->GetUpdateLibrary()->SetReleaseTrack(channel); | 288 CrosLibrary::Get()->GetUpdateLibrary()->SetReleaseTrack(channel); |
289 } | 289 } |
290 | 290 |
291 void AboutPageHandler::CheckNow(const ListValue* args) { | 291 void AboutPageHandler::CheckNow(const ListValue* args) { |
292 // Make sure that libcros is loaded and OOBE is complete. | 292 // Make sure that libcros is loaded and OOBE is complete. |
293 if (CrosLibrary::Get()->EnsureLoaded() && | 293 if (!WizardController::default_controller() || |
294 (!WizardController::default_controller() || | 294 WizardController::IsDeviceRegistered()) { |
295 WizardController::IsDeviceRegistered())) { | |
296 CrosLibrary::Get()->GetUpdateLibrary()-> | 295 CrosLibrary::Get()->GetUpdateLibrary()-> |
297 RequestUpdateCheck(NULL, // no callback | 296 RequestUpdateCheck(NULL, // no callback |
298 NULL); // no userdata | 297 NULL); // no userdata |
299 } | 298 } |
300 } | 299 } |
301 | 300 |
302 void AboutPageHandler::RestartNow(const ListValue* args) { | 301 void AboutPageHandler::RestartNow(const ListValue* args) { |
303 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 302 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
304 } | 303 } |
305 | 304 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 if (CrosLibrary::Get()->GetUpdateLibrary()->HasObserver(observer)) { | 416 if (CrosLibrary::Get()->GetUpdateLibrary()->HasObserver(observer)) { |
418 // If UpdateLibrary still has the observer, then the page handler is valid. | 417 // If UpdateLibrary still has the observer, then the page handler is valid. |
419 AboutPageHandler* handler = observer->page_handler(); | 418 AboutPageHandler* handler = observer->page_handler(); |
420 scoped_ptr<Value> channel_string(Value::CreateStringValue(channel)); | 419 scoped_ptr<Value> channel_string(Value::CreateStringValue(channel)); |
421 handler->web_ui_->CallJavascriptFunction( | 420 handler->web_ui_->CallJavascriptFunction( |
422 "AboutPage.updateSelectedOptionCallback", *channel_string); | 421 "AboutPage.updateSelectedOptionCallback", *channel_string); |
423 } | 422 } |
424 } | 423 } |
425 | 424 |
426 } // namespace chromeos | 425 } // namespace chromeos |
OLD | NEW |