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

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

Issue 10236003: Added RefreshPolicies to PolicyService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/policy.js ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "chrome/browser/policy/cloud_policy_subsystem.h" 12 #include "chrome/browser/policy/cloud_policy_subsystem.h"
12 #include "chrome/browser/policy/configuration_policy_reader.h" 13 #include "chrome/browser/policy/configuration_policy_reader.h"
13 #include "content/public/browser/web_ui_controller.h" 14 #include "content/public/browser/web_ui_controller.h"
14 #include "content/public/browser/web_ui_message_handler.h" 15 #include "content/public/browser/web_ui_message_handler.h"
15 16
16 namespace policy { 17 namespace policy {
17 class CloudPolicyDataStore; 18 class CloudPolicyDataStore;
18 } 19 }
19 20
(...skipping 11 matching lines...) Expand all
31 virtual void OnPolicyValuesChanged() OVERRIDE; 32 virtual void OnPolicyValuesChanged() OVERRIDE;
32 33
33 private: 34 private:
34 35
35 // Callback for the "requestData" message. The parameter |args| is unused. 36 // Callback for the "requestData" message. The parameter |args| is unused.
36 void HandleRequestData(const ListValue* args); 37 void HandleRequestData(const ListValue* args);
37 38
38 // Callback for the "fetchPolicy" message. The parameter |args| is unused. 39 // Callback for the "fetchPolicy" message. The parameter |args| is unused.
39 void HandleFetchPolicy(const ListValue* args); 40 void HandleFetchPolicy(const ListValue* args);
40 41
41 // Send requested data to UI. |is_policy_update| should be set to true when 42 // Callback for completion of a RefreshPolicies call.
42 // policy data is pushed to the UI without having been requested by a 43 void OnRefreshDone();
43 // javascript message and to false otherwise. 44
44 void SendDataToUI(bool is_policy_update); 45 // Sends policy data to UI.
46 void SendDataToUI();
45 47
46 // Returns a DictionaryValue pointer containing information about the status 48 // Returns a DictionaryValue pointer containing information about the status
47 // of the policy system. The caller acquires ownership of the returned 49 // of the policy system. The caller acquires ownership of the returned
48 // DictionaryValue pointer. 50 // DictionaryValue pointer.
49 DictionaryValue* GetStatusData(); 51 DictionaryValue* GetStatusData();
50 52
51 // Returns the time at which policy was last fetched by the 53 // Returns the time at which policy was last fetched by the
52 // CloudPolicySubsystem |subsystem| in string form. 54 // CloudPolicySubsystem |subsystem| in string form.
53 string16 GetLastFetchTime(policy::CloudPolicySubsystem* subsystem); 55 string16 GetLastFetchTime(policy::CloudPolicySubsystem* subsystem);
54 56
55 // Reads the device id from |data_store| and returns it as a string16. 57 // Reads the device id from |data_store| and returns it as a string16.
56 string16 GetDeviceId(const policy::CloudPolicyDataStore* data_store); 58 string16 GetDeviceId(const policy::CloudPolicyDataStore* data_store);
57 59
58 // Reads the policy fetch interval from the preferences specified by 60 // Reads the policy fetch interval from the preferences specified by
59 // |refresh_pref| and returns it as a string16. 61 // |refresh_pref| and returns it as a string16.
60 string16 GetPolicyFetchInterval(const char* refresh_pref); 62 string16 GetPolicyFetchInterval(const char* refresh_pref);
61 63
62 // Returns the string corresponding to the CloudPolicySubsystem::ErrorDetails 64 // Returns the string corresponding to the CloudPolicySubsystem::ErrorDetails
63 // enum value |error_details|. 65 // enum value |error_details|.
64 static string16 CreateStatusMessageString( 66 static string16 CreateStatusMessageString(
65 policy::CloudPolicySubsystem::ErrorDetails error_details); 67 policy::CloudPolicySubsystem::ErrorDetails error_details);
66 68
67 scoped_ptr<policy::PolicyStatus> policy_status_; 69 scoped_ptr<policy::PolicyStatus> policy_status_;
68 70
71 // Used to post a callback to RefreshPolicies with a WeakPtr to |this|.
72 base::WeakPtrFactory<PolicyUIHandler> weak_factory_;
73
69 DISALLOW_COPY_AND_ASSIGN(PolicyUIHandler); 74 DISALLOW_COPY_AND_ASSIGN(PolicyUIHandler);
70 }; 75 };
71 76
72 // The Web UI handler for about:policy. 77 // The Web UI handler for about:policy.
73 class PolicyUI : public content::WebUIController { 78 class PolicyUI : public content::WebUIController {
74 public: 79 public:
75 explicit PolicyUI(content::WebUI* web_ui); 80 explicit PolicyUI(content::WebUI* web_ui);
76 virtual ~PolicyUI(); 81 virtual ~PolicyUI();
77 82
78 private: 83 private:
79 DISALLOW_COPY_AND_ASSIGN(PolicyUI); 84 DISALLOW_COPY_AND_ASSIGN(PolicyUI);
80 }; 85 };
81 86
82 #endif // CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_ 87 #endif // CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/policy.js ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698