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/sim_unlock_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/sim_unlock_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
14 #include "chrome/browser/chromeos/cros/network_library.h" | 14 #include "chrome/browser/chromeos/cros/network_library.h" |
15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
18 #include "chrome/common/jstemplate_builder.h" | 18 #include "chrome/common/jstemplate_builder.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "content/browser/browser_thread.h" | 20 #include "content/browser/browser_thread.h" |
21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/browser/tab_contents/tab_contents.h" |
| 22 #include "content/common/content_notification_types.h" |
22 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
23 #include "content/common/notification_type.h" | |
24 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 // JS API callbacks names. | 31 // JS API callbacks names. |
32 const char kJsApiCancel[] = "cancel"; | 32 const char kJsApiCancel[] = "cancel"; |
33 const char kJsApiChangePinCode[] = "changePinCode"; | 33 const char kJsApiChangePinCode[] = "changePinCode"; |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 break; | 437 break; |
438 case CODE_PUK: | 438 case CODE_PUK: |
439 DCHECK(!new_pin_.empty()); | 439 DCHECK(!new_pin_.empty()); |
440 lib->UnblockPin(code, new_pin_); | 440 lib->UnblockPin(code, new_pin_); |
441 break; | 441 break; |
442 } | 442 } |
443 } | 443 } |
444 | 444 |
445 void SimUnlockHandler::NotifyOnEnterPinEnded(bool cancelled) { | 445 void SimUnlockHandler::NotifyOnEnterPinEnded(bool cancelled) { |
446 NotificationService::current()->Notify( | 446 NotificationService::current()->Notify( |
447 NotificationType::ENTER_PIN_ENDED, | 447 chrome::ENTER_PIN_ENDED, |
448 NotificationService::AllSources(), | 448 NotificationService::AllSources(), |
449 Details<bool>(&cancelled)); | 449 Details<bool>(&cancelled)); |
450 } | 450 } |
451 | 451 |
452 void SimUnlockHandler::NotifyOnRequirePinChangeEnded(bool new_value) { | 452 void SimUnlockHandler::NotifyOnRequirePinChangeEnded(bool new_value) { |
453 NotificationService::current()->Notify( | 453 NotificationService::current()->Notify( |
454 NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED, | 454 chrome::REQUIRE_PIN_SETTING_CHANGE_ENDED, |
455 NotificationService::AllSources(), | 455 NotificationService::AllSources(), |
456 Details<bool>(&new_value)); | 456 Details<bool>(&new_value)); |
457 } | 457 } |
458 | 458 |
459 void SimUnlockHandler::HandleCancel(const ListValue* args) { | 459 void SimUnlockHandler::HandleCancel(const ListValue* args) { |
460 const size_t kEnterCodeParamCount = 0; | 460 const size_t kEnterCodeParamCount = 0; |
461 if (args->GetSize() != kEnterCodeParamCount) { | 461 if (args->GetSize() != kEnterCodeParamCount) { |
462 NOTREACHED(); | 462 NOTREACHED(); |
463 return; | 463 return; |
464 } | 464 } |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 SimUnlockHandler* handler = new SimUnlockHandler(); | 657 SimUnlockHandler* handler = new SimUnlockHandler(); |
658 AddMessageHandler((handler)->Attach(this)); | 658 AddMessageHandler((handler)->Attach(this)); |
659 handler->Init(contents); | 659 handler->Init(contents); |
660 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 660 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
661 | 661 |
662 // Set up the chrome://sim-unlock/ source. | 662 // Set up the chrome://sim-unlock/ source. |
663 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 663 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
664 } | 664 } |
665 | 665 |
666 } // namespace chromeos | 666 } // namespace chromeos |
OLD | NEW |