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

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

Issue 2159223002: Fixed cloud policy refresh API to return correct value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 4 years, 4 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
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_handler.h" 5 #include "chrome/browser/ui/webui/policy_ui_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 if (policy && policy->has_annotated_asset_id()) 131 if (policy && policy->has_annotated_asset_id())
132 dict->SetString("assetId", policy->annotated_asset_id()); 132 dict->SetString("assetId", policy->annotated_asset_id());
133 if (policy && policy->has_annotated_location()) 133 if (policy && policy->has_annotated_location())
134 dict->SetString("location", policy->annotated_location()); 134 dict->SetString("location", policy->annotated_location());
135 if (policy && policy->has_directory_api_id()) 135 if (policy && policy->has_directory_api_id())
136 dict->SetString("directoryApiId", policy->directory_api_id()); 136 dict->SetString("directoryApiId", policy->directory_api_id());
137 137
138 base::TimeDelta refresh_interval = 138 base::TimeDelta refresh_interval =
139 base::TimeDelta::FromMilliseconds(refresh_scheduler ? 139 base::TimeDelta::FromMilliseconds(refresh_scheduler ?
140 refresh_scheduler->refresh_delay() : 140 refresh_scheduler->GetActualRefreshDelay() :
141 policy::CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); 141 policy::CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs);
142 base::Time last_refresh_time = refresh_scheduler ? 142 base::Time last_refresh_time = refresh_scheduler ?
143 refresh_scheduler->last_refresh() : base::Time(); 143 refresh_scheduler->last_refresh() : base::Time();
144 144
145 bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK && 145 bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK &&
146 client && client->status() == policy::DM_STATUS_SUCCESS; 146 client && client->status() == policy::DM_STATUS_SUCCESS;
147 dict->SetBoolean("error", !no_error); 147 dict->SetBoolean("error", !no_error);
148 dict->SetString("status", status); 148 dict->SetString("status", status);
149 dict->SetString("clientId", client_id); 149 dict->SetString("clientId", client_id);
150 dict->SetString("username", username); 150 dict->SetString("username", username);
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 743 }
744 744
745 void PolicyUIHandler::OnRefreshPoliciesDone() const { 745 void PolicyUIHandler::OnRefreshPoliciesDone() const {
746 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone"); 746 web_ui()->CallJavascriptFunctionUnsafe("policy.Page.reloadPoliciesDone");
747 } 747 }
748 748
749 policy::PolicyService* PolicyUIHandler::GetPolicyService() const { 749 policy::PolicyService* PolicyUIHandler::GetPolicyService() const {
750 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext( 750 return policy::ProfilePolicyConnectorFactory::GetForBrowserContext(
751 web_ui()->GetWebContents()->GetBrowserContext())->policy_service(); 751 web_ui()->GetWebContents()->GetBrowserContext())->policy_service();
752 } 752 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698