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

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

Issue 1106193003: 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"
39 #include "components/policy/core/common/schema.h" 40 #include "components/policy/core/common/schema.h"
40 #include "components/policy/core/common/schema_map.h" 41 #include "components/policy/core/common/schema_map.h"
41 #include "components/policy/core/common/schema_registry.h" 42 #include "components/policy/core/common/schema_registry.h"
42 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
43 #include "content/public/browser/web_ui.h" 44 #include "content/public/browser/web_ui.h"
44 #include "content/public/browser/web_ui_data_source.h" 45 #include "content/public/browser/web_ui_data_source.h"
45 #include "content/public/browser/web_ui_message_handler.h" 46 #include "content/public/browser/web_ui_message_handler.h"
46 #include "google_apis/gaia/gaia_auth_util.h" 47 #include "google_apis/gaia/gaia_auth_util.h"
47 #include "grit/browser_resources.h" 48 #include "grit/browser_resources.h"
48 #include "grit/components_strings.h" 49 #include "grit/components_strings.h"
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 web_ui()->CallJavascriptFunction("policy.Page.setStatus", status); 801 web_ui()->CallJavascriptFunction("policy.Page.setStatus", status);
801 } 802 }
802 803
803 void PolicyUIHandler::HandleInitialized(const base::ListValue* args) { 804 void PolicyUIHandler::HandleInitialized(const base::ListValue* args) {
804 SendPolicyNames(); 805 SendPolicyNames();
805 SendPolicyValues(); 806 SendPolicyValues();
806 SendStatus(); 807 SendStatus();
807 } 808 }
808 809
809 void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) { 810 void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) {
811 #if defined(OS_CHROMEOS)
812 // Allow user to manually fetch remote commands, in case invalidation
813 // service is not working properly.
814 // TODO(binjin): evaluate and possibly remove this after invalidation
bartfab (slow) 2015/04/29 15:21:38 Nit: Please reference a bug number.
binjin 2015/04/29 17:24:42 Done.
815 // service is landed and tested.
816 policy::BrowserPolicyConnectorChromeOS* connector =
bartfab (slow) 2015/04/29 15:21:38 Nit: #include "chrome/browser/chromeos/policy/brow
binjin 2015/04/29 17:24:42 It's already included, inside defined(OS_CHROMEOS)
817 g_browser_process->platform_part()->browser_policy_connector_chromeos();
bartfab (slow) 2015/04/29 15:21:38 Nit: #include "chrome/browser/browser_process_plat
binjin 2015/04/29 17:24:42 Done.
818 connector->GetDeviceCloudPolicyManager()
819 ->core()
820 ->remote_commands_service()
821 ->FetchRemoteCommands();
822 #endif
810 GetPolicyService()->RefreshPolicies( 823 GetPolicyService()->RefreshPolicies(
811 base::Bind(&PolicyUIHandler::OnRefreshPoliciesDone, 824 base::Bind(&PolicyUIHandler::OnRefreshPoliciesDone,
812 weak_factory_.GetWeakPtr())); 825 weak_factory_.GetWeakPtr()));
813 } 826 }
814 827
815 void PolicyUIHandler::OnRefreshPoliciesDone() const { 828 void PolicyUIHandler::OnRefreshPoliciesDone() const {
816 web_ui()->CallJavascriptFunction("policy.Page.reloadPoliciesDone"); 829 web_ui()->CallJavascriptFunction("policy.Page.reloadPoliciesDone");
817 } 830 }
818 831
819 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { 832 policy::PolicyService* PolicyUIHandler::GetPolicyService() const {
820 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( 833 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
821 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); 834 web_ui()->GetWebContents()->GetBrowserContext())->policy_service();
822 } 835 }
823 836
824 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { 837 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) {
825 web_ui->AddMessageHandler(new PolicyUIHandler); 838 web_ui->AddMessageHandler(new PolicyUIHandler);
826 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), 839 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui),
827 CreatePolicyUIHTMLSource()); 840 CreatePolicyUIHTMLSource());
828 } 841 }
829 842
830 PolicyUI::~PolicyUI() { 843 PolicyUI::~PolicyUI() {
831 } 844 }
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