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

Side by Side Diff: chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
OLDNEW
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/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/string_piece.h" 13 #include "base/string_piece.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/chromeos/cros/cros_library.h" 15 #include "chrome/browser/chromeos/cros/cros_library.h"
16 #include "chrome/browser/chromeos/cros/network_library.h" 16 #include "chrome/browser/chromeos/cros/network_library.h"
17 #include "chrome/browser/chromeos/sim_dialog_delegate.h" 17 #include "chrome/browser/chromeos/sim_dialog_delegate.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
20 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/jstemplate_builder.h" 21 #include "chrome/common/jstemplate_builder.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "content/browser/browser_thread.h" 23 #include "content/browser/browser_thread.h"
24 #include "content/browser/tab_contents/tab_contents.h" 24 #include "content/browser/tab_contents/tab_contents.h"
25 #include "content/common/notification_service.h" 25 #include "content/public/browser/notification_service.h"
26 #include "grit/browser_resources.h" 26 #include "grit/browser_resources.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 29 #include "ui/base/resource/resource_bundle.h"
30 30
31 namespace { 31 namespace {
32 32
33 // JS API callbacks names. 33 // JS API callbacks names.
34 const char kJsApiCancel[] = "cancel"; 34 const char kJsApiCancel[] = "cancel";
35 const char kJsApiChangePinCode[] = "changePinCode"; 35 const char kJsApiChangePinCode[] = "changePinCode";
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 454 }
455 break; 455 break;
456 case CODE_PUK: 456 case CODE_PUK:
457 DCHECK(!new_pin_.empty()); 457 DCHECK(!new_pin_.empty());
458 lib->UnblockPin(code, new_pin_); 458 lib->UnblockPin(code, new_pin_);
459 break; 459 break;
460 } 460 }
461 } 461 }
462 462
463 void SimUnlockHandler::NotifyOnEnterPinEnded(bool cancelled) { 463 void SimUnlockHandler::NotifyOnEnterPinEnded(bool cancelled) {
464 NotificationService::current()->Notify( 464 content::NotificationService::current()->Notify(
465 chrome::NOTIFICATION_ENTER_PIN_ENDED, 465 chrome::NOTIFICATION_ENTER_PIN_ENDED,
466 NotificationService::AllSources(), 466 content::NotificationService::AllSources(),
467 content::Details<bool>(&cancelled)); 467 content::Details<bool>(&cancelled));
468 } 468 }
469 469
470 void SimUnlockHandler::NotifyOnRequirePinChangeEnded(bool new_value) { 470 void SimUnlockHandler::NotifyOnRequirePinChangeEnded(bool new_value) {
471 NotificationService::current()->Notify( 471 content::NotificationService::current()->Notify(
472 chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, 472 chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED,
473 NotificationService::AllSources(), 473 content::NotificationService::AllSources(),
474 content::Details<bool>(&new_value)); 474 content::Details<bool>(&new_value));
475 } 475 }
476 476
477 void SimUnlockHandler::HandleCancel(const ListValue* args) { 477 void SimUnlockHandler::HandleCancel(const ListValue* args) {
478 const size_t kEnterCodeParamCount = 0; 478 const size_t kEnterCodeParamCount = 0;
479 if (args->GetSize() != kEnterCodeParamCount) { 479 if (args->GetSize() != kEnterCodeParamCount) {
480 NOTREACHED(); 480 NOTREACHED();
481 return; 481 return;
482 } 482 }
483 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); 483 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr());
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 AddMessageHandler((handler)->Attach(this)); 676 AddMessageHandler((handler)->Attach(this));
677 handler->Init(contents); 677 handler->Init(contents);
678 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); 678 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource();
679 679
680 // Set up the chrome://sim-unlock/ source. 680 // Set up the chrome://sim-unlock/ source.
681 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 681 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
682 profile->GetChromeURLDataManager()->AddDataSource(html_source); 682 profile->GetChromeURLDataManager()->AddDataSource(html_source);
683 } 683 }
684 684
685 } // namespace chromeos 685 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698