| 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/chromeos/mobile_setup_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" |
| 12 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 13 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 18 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
| 21 #include "base/timer.h" | 22 #include "base/timer.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return; | 478 return; |
| 478 LoadCellularConfig(); | 479 LoadCellularConfig(); |
| 479 if (!chromeos::CrosLibrary::Get()->GetNetworkLibrary()->IsLocked()) | 480 if (!chromeos::CrosLibrary::Get()->GetNetworkLibrary()->IsLocked()) |
| 480 SetupActivationProcess(network); | 481 SetupActivationProcess(network); |
| 481 else | 482 else |
| 482 already_running_ = true; | 483 already_running_ = true; |
| 483 } | 484 } |
| 484 | 485 |
| 485 void MobileSetupHandler::RegisterMessages() { | 486 void MobileSetupHandler::RegisterMessages() { |
| 486 web_ui_->RegisterMessageCallback(kJsApiStartActivation, | 487 web_ui_->RegisterMessageCallback(kJsApiStartActivation, |
| 487 NewCallback(this, &MobileSetupHandler::HandleStartActivation)); | 488 base::Bind(&MobileSetupHandler::HandleStartActivation, |
| 489 base::Unretained(this))); |
| 488 web_ui_->RegisterMessageCallback(kJsApiSetTransactionStatus, | 490 web_ui_->RegisterMessageCallback(kJsApiSetTransactionStatus, |
| 489 NewCallback(this, &MobileSetupHandler::HandleSetTransactionStatus)); | 491 base::Bind(&MobileSetupHandler::HandleSetTransactionStatus, |
| 492 base::Unretained(this))); |
| 490 } | 493 } |
| 491 | 494 |
| 492 void MobileSetupHandler::OnNetworkManagerChanged( | 495 void MobileSetupHandler::OnNetworkManagerChanged( |
| 493 chromeos::NetworkLibrary* cros) { | 496 chromeos::NetworkLibrary* cros) { |
| 494 if (state_ == PLAN_ACTIVATION_PAGE_LOADING) | 497 if (state_ == PLAN_ACTIVATION_PAGE_LOADING) |
| 495 return; | 498 return; |
| 496 // Note that even though we get here when the service has | 499 // Note that even though we get here when the service has |
| 497 // reappeared after disappearing earlier in the activation | 500 // reappeared after disappearing earlier in the activation |
| 498 // process, there's no need to re-establish the NetworkObserver, | 501 // process, there's no need to re-establish the NetworkObserver, |
| 499 // because the service path remains the same. | 502 // because the service path remains the same. |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 MobileSetupHandler* handler = new MobileSetupHandler(service_path); | 1329 MobileSetupHandler* handler = new MobileSetupHandler(service_path); |
| 1327 AddMessageHandler((handler)->Attach(this)); | 1330 AddMessageHandler((handler)->Attach(this)); |
| 1328 handler->Init(contents); | 1331 handler->Init(contents); |
| 1329 MobileSetupUIHTMLSource* html_source = | 1332 MobileSetupUIHTMLSource* html_source = |
| 1330 new MobileSetupUIHTMLSource(service_path); | 1333 new MobileSetupUIHTMLSource(service_path); |
| 1331 | 1334 |
| 1332 // Set up the chrome://mobilesetup/ source. | 1335 // Set up the chrome://mobilesetup/ source. |
| 1333 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 1336 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 1334 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 1337 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 1335 } | 1338 } |
| OLD | NEW |