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

Side by Side Diff: chrome/browser/ui/webui/policy_ui.cc

Issue 1132223003: Revert of Allow user to manually fetch remote commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remote-0420
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 #include "components/policy/core/common/cloud/cloud_policy_client.h" 29 #include "components/policy/core/common/cloud/cloud_policy_client.h"
30 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 30 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
31 #include "components/policy/core/common/cloud/cloud_policy_core.h" 31 #include "components/policy/core/common/cloud/cloud_policy_core.h"
32 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" 32 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h"
33 #include "components/policy/core/common/cloud/cloud_policy_store.h" 33 #include "components/policy/core/common/cloud/cloud_policy_store.h"
34 #include "components/policy/core/common/cloud/cloud_policy_validator.h" 34 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
35 #include "components/policy/core/common/policy_map.h" 35 #include "components/policy/core/common/policy_map.h"
36 #include "components/policy/core/common/policy_namespace.h" 36 #include "components/policy/core/common/policy_namespace.h"
37 #include "components/policy/core/common/policy_service.h" 37 #include "components/policy/core/common/policy_service.h"
38 #include "components/policy/core/common/policy_types.h" 38 #include "components/policy/core/common/policy_types.h"
39 #include "components/policy/core/common/remote_commands/remote_commands_service. h"
40 #include "components/policy/core/common/schema.h" 39 #include "components/policy/core/common/schema.h"
41 #include "components/policy/core/common/schema_map.h" 40 #include "components/policy/core/common/schema_map.h"
42 #include "components/policy/core/common/schema_registry.h" 41 #include "components/policy/core/common/schema_registry.h"
43 #include "content/public/browser/web_contents.h" 42 #include "content/public/browser/web_contents.h"
44 #include "content/public/browser/web_ui.h" 43 #include "content/public/browser/web_ui.h"
45 #include "content/public/browser/web_ui_data_source.h" 44 #include "content/public/browser/web_ui_data_source.h"
46 #include "content/public/browser/web_ui_message_handler.h" 45 #include "content/public/browser/web_ui_message_handler.h"
47 #include "google_apis/gaia/gaia_auth_util.h" 46 #include "google_apis/gaia/gaia_auth_util.h"
48 #include "grit/browser_resources.h" 47 #include "grit/browser_resources.h"
49 #include "grit/components_strings.h" 48 #include "grit/components_strings.h"
50 #include "policy/policy_constants.h" 49 #include "policy/policy_constants.h"
51 #include "policy/proto/device_management_backend.pb.h" 50 #include "policy/proto/device_management_backend.pb.h"
52 #include "ui/base/l10n/l10n_util.h" 51 #include "ui/base/l10n/l10n_util.h"
53 #include "ui/base/l10n/time_format.h" 52 #include "ui/base/l10n/time_format.h"
54 53
55 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
56 #include "chrome/browser/browser_process_platform_part.h"
57 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 55 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
58 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 56 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
59 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 57 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
60 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" 58 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
61 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" 59 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h"
62 #include "components/user_manager/user_manager.h" 60 #include "components/user_manager/user_manager.h"
63 #else 61 #else
64 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" 62 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h"
65 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 63 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
66 #endif 64 #endif
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 web_ui()->CallJavascriptFunction("policy.Page.setStatus", status); 800 web_ui()->CallJavascriptFunction("policy.Page.setStatus", status);
803 } 801 }
804 802
805 void PolicyUIHandler::HandleInitialized(const base::ListValue* args) { 803 void PolicyUIHandler::HandleInitialized(const base::ListValue* args) {
806 SendPolicyNames(); 804 SendPolicyNames();
807 SendPolicyValues(); 805 SendPolicyValues();
808 SendStatus(); 806 SendStatus();
809 } 807 }
810 808
811 void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) { 809 void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) {
812 #if defined(OS_CHROMEOS)
813 // Allow user to manually fetch remote commands, in case invalidation
814 // service is not working properly.
815 // TODO(binjin): evaluate and possibly remove this after invalidation
816 // service is landed and tested. http://crbug.com/480982
817 policy::BrowserPolicyConnectorChromeOS* connector =
818 g_browser_process->platform_part()->browser_policy_connector_chromeos();
819 connector->GetDeviceCloudPolicyManager()
820 ->core()
821 ->remote_commands_service()
822 ->FetchRemoteCommands();
823 #endif
824 GetPolicyService()->RefreshPolicies( 810 GetPolicyService()->RefreshPolicies(
825 base::Bind(&PolicyUIHandler::OnRefreshPoliciesDone, 811 base::Bind(&PolicyUIHandler::OnRefreshPoliciesDone,
826 weak_factory_.GetWeakPtr())); 812 weak_factory_.GetWeakPtr()));
827 } 813 }
828 814
829 void PolicyUIHandler::OnRefreshPoliciesDone() const { 815 void PolicyUIHandler::OnRefreshPoliciesDone() const {
830 web_ui()->CallJavascriptFunction("policy.Page.reloadPoliciesDone"); 816 web_ui()->CallJavascriptFunction("policy.Page.reloadPoliciesDone");
831 } 817 }
832 818
833 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { 819 policy::PolicyService* PolicyUIHandler::GetPolicyService() const {
834 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( 820 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
835 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); 821 web_ui()->GetWebContents()->GetBrowserContext())->policy_service();
836 } 822 }
837 823
838 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { 824 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) {
839 web_ui->AddMessageHandler(new PolicyUIHandler); 825 web_ui->AddMessageHandler(new PolicyUIHandler);
840 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), 826 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui),
841 CreatePolicyUIHTMLSource()); 827 CreatePolicyUIHTMLSource());
842 } 828 }
843 829
844 PolicyUI::~PolicyUI() { 830 PolicyUI::~PolicyUI() {
845 } 831 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698