| 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 387 |
| 388 void GetChromePolicyValues(base::DictionaryValue* values) const; | 388 void GetChromePolicyValues(base::DictionaryValue* values) const; |
| 389 | 389 |
| 390 void HandleInitialized(const base::ListValue* args); | 390 void HandleInitialized(const base::ListValue* args); |
| 391 void HandleReloadPolicies(const base::ListValue* args); | 391 void HandleReloadPolicies(const base::ListValue* args); |
| 392 | 392 |
| 393 void OnRefreshPoliciesDone() const; | 393 void OnRefreshPoliciesDone() const; |
| 394 | 394 |
| 395 policy::PolicyService* GetPolicyService() const; | 395 policy::PolicyService* GetPolicyService() const; |
| 396 | 396 |
| 397 bool initialized_; | |
| 398 std::string device_domain_; | 397 std::string device_domain_; |
| 399 | 398 |
| 400 // Providers that supply status dictionaries for user and device policy, | 399 // Providers that supply status dictionaries for user and device policy, |
| 401 // respectively. These are created on initialization time as appropriate for | 400 // respectively. These are created on initialization time as appropriate for |
| 402 // the platform (Chrome OS / desktop) and type of policy that is in effect. | 401 // the platform (Chrome OS / desktop) and type of policy that is in effect. |
| 403 scoped_ptr<CloudPolicyStatusProvider> user_status_provider_; | 402 scoped_ptr<CloudPolicyStatusProvider> user_status_provider_; |
| 404 scoped_ptr<CloudPolicyStatusProvider> device_status_provider_; | 403 scoped_ptr<CloudPolicyStatusProvider> device_status_provider_; |
| 405 | 404 |
| 406 #if defined(ENABLE_EXTENSIONS) | 405 #if defined(ENABLE_EXTENSIONS) |
| 407 content::NotificationRegistrar registrar_; | 406 content::NotificationRegistrar registrar_; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (user_id == user_id_) | 518 if (user_id == user_id_) |
| 520 NotifyStatusChange(); | 519 NotifyStatusChange(); |
| 521 } | 520 } |
| 522 | 521 |
| 523 void DeviceLocalAccountPolicyStatusProvider::OnDeviceLocalAccountsChanged() { | 522 void DeviceLocalAccountPolicyStatusProvider::OnDeviceLocalAccountsChanged() { |
| 524 NotifyStatusChange(); | 523 NotifyStatusChange(); |
| 525 } | 524 } |
| 526 #endif | 525 #endif |
| 527 | 526 |
| 528 PolicyUIHandler::PolicyUIHandler() | 527 PolicyUIHandler::PolicyUIHandler() |
| 529 : initialized_(false), | 528 : weak_factory_(this) { |
| 530 weak_factory_(this) { | |
| 531 } | 529 } |
| 532 | 530 |
| 533 PolicyUIHandler::~PolicyUIHandler() { | 531 PolicyUIHandler::~PolicyUIHandler() { |
| 534 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this); | 532 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this); |
| 535 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); | 533 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_EXTENSIONS, this); |
| 536 policy::SchemaRegistry* registry = | 534 policy::SchemaRegistry* registry = |
| 537 policy::SchemaRegistryServiceFactory::GetForContext( | 535 policy::SchemaRegistryServiceFactory::GetForContext( |
| 538 Profile::FromWebUI(web_ui())->GetOriginalProfile())->registry(); | 536 Profile::FromWebUI(web_ui())->GetOriginalProfile())->registry(); |
| 539 registry->RemoveObserver(this); | 537 registry->RemoveObserver(this); |
| 540 } | 538 } |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 } | 808 } |
| 811 | 809 |
| 812 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 810 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 813 web_ui->AddMessageHandler(new PolicyUIHandler); | 811 web_ui->AddMessageHandler(new PolicyUIHandler); |
| 814 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 812 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
| 815 CreatePolicyUIHTMLSource()); | 813 CreatePolicyUIHTMLSource()); |
| 816 } | 814 } |
| 817 | 815 |
| 818 PolicyUI::~PolicyUI() { | 816 PolicyUI::~PolicyUI() { |
| 819 } | 817 } |
| OLD | NEW |