| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy_ui.h" | 5 #include "chrome/browser/ui/webui/policy_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 device_status_provider_.reset(new CloudPolicyStatusProvider()); | 570 device_status_provider_.reset(new CloudPolicyStatusProvider()); |
| 571 | 571 |
| 572 base::Closure update_callback(base::Bind(&PolicyUIHandler::SendStatus, | 572 base::Closure update_callback(base::Bind(&PolicyUIHandler::SendStatus, |
| 573 base::Unretained(this))); | 573 base::Unretained(this))); |
| 574 user_status_provider_->SetStatusChangeCallback(update_callback); | 574 user_status_provider_->SetStatusChangeCallback(update_callback); |
| 575 device_status_provider_->SetStatusChangeCallback(update_callback); | 575 device_status_provider_->SetStatusChangeCallback(update_callback); |
| 576 GetPolicyService()->AddObserver(policy::POLICY_DOMAIN_CHROME, this); | 576 GetPolicyService()->AddObserver(policy::POLICY_DOMAIN_CHROME, this); |
| 577 GetPolicyService()->AddObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); | 577 GetPolicyService()->AddObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); |
| 578 | 578 |
| 579 registrar_.Add(this, | 579 registrar_.Add(this, |
| 580 chrome::NOTIFICATION_EXTENSION_LOADED, | 580 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 581 content::NotificationService::AllSources()); | 581 content::NotificationService::AllSources()); |
| 582 registrar_.Add(this, | 582 registrar_.Add(this, |
| 583 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 583 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 584 content::NotificationService::AllSources()); | 584 content::NotificationService::AllSources()); |
| 585 | 585 |
| 586 web_ui()->RegisterMessageCallback( | 586 web_ui()->RegisterMessageCallback( |
| 587 "initialized", | 587 "initialized", |
| 588 base::Bind(&PolicyUIHandler::HandleInitialized, base::Unretained(this))); | 588 base::Bind(&PolicyUIHandler::HandleInitialized, base::Unretained(this))); |
| 589 web_ui()->RegisterMessageCallback( | 589 web_ui()->RegisterMessageCallback( |
| 590 "reloadPolicies", | 590 "reloadPolicies", |
| 591 base::Bind(&PolicyUIHandler::HandleReloadPolicies, | 591 base::Bind(&PolicyUIHandler::HandleReloadPolicies, |
| 592 base::Unretained(this))); | 592 base::Unretained(this))); |
| 593 } | 593 } |
| 594 | 594 |
| 595 void PolicyUIHandler::Observe(int type, | 595 void PolicyUIHandler::Observe(int type, |
| 596 const content::NotificationSource& source, | 596 const content::NotificationSource& source, |
| 597 const content::NotificationDetails& details) { | 597 const content::NotificationDetails& details) { |
| 598 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || | 598 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || |
| 599 type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); | 599 type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); |
| 600 SendPolicyNames(); | 600 SendPolicyNames(); |
| 601 SendPolicyValues(); | 601 SendPolicyValues(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void PolicyUIHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, | 604 void PolicyUIHandler::OnPolicyUpdated(const policy::PolicyNamespace& ns, |
| 605 const policy::PolicyMap& previous, | 605 const policy::PolicyMap& previous, |
| 606 const policy::PolicyMap& current) { | 606 const policy::PolicyMap& current) { |
| 607 SendPolicyValues(); | 607 SendPolicyValues(); |
| 608 } | 608 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 788 } |
| 789 | 789 |
| 790 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 790 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 791 web_ui->AddMessageHandler(new PolicyUIHandler); | 791 web_ui->AddMessageHandler(new PolicyUIHandler); |
| 792 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 792 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
| 793 CreatePolicyUIHTMLSource()); | 793 CreatePolicyUIHTMLSource()); |
| 794 } | 794 } |
| 795 | 795 |
| 796 PolicyUI::~PolicyUI() { | 796 PolicyUI::~PolicyUI() { |
| 797 } | 797 } |
| OLD | NEW |