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

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

Issue 7828042: Implemented status section functionality for about:policy. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased patch. Created 9 years, 3 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/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/time.h"
10 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/policy/cloud_policy_data_store.h"
13 #include "chrome/browser/policy/cloud_policy_subsystem.h"
11 #include "chrome/browser/policy/configuration_policy_reader.h" 14 #include "chrome/browser/policy/configuration_policy_reader.h"
12 #include "chrome/browser/ui/webui/chrome_web_ui.h" 15 #include "chrome/browser/ui/webui/chrome_web_ui.h"
13 #include "content/common/notification_observer.h" 16 #include "content/common/notification_observer.h"
14 17
15 // The base class handler of Javascript messages of the about:policy page. 18 // The base class handler of Javascript messages of the about:policy page.
16 class PolicyUIHandler : public WebUIMessageHandler { 19 class PolicyUIHandler : public WebUIMessageHandler,
20 public policy::PolicyStatus::Observer {
17 public: 21 public:
18 PolicyUIHandler(); 22 PolicyUIHandler();
19 virtual ~PolicyUIHandler(); 23 virtual ~PolicyUIHandler();
20 24
21 // WebUIMessageHandler implementation. 25 // WebUIMessageHandler implementation.
22 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE; 26 virtual WebUIMessageHandler* Attach(WebUI* web_ui) OVERRIDE;
23 virtual void RegisterMessages() OVERRIDE; 27 virtual void RegisterMessages() OVERRIDE;
24 28
29 // policy::ConfigurationPolicyReader::Observer implementation.
30 virtual void OnPolicyValuesChanged() OVERRIDE;
31
25 private: 32 private:
26 typedef policy::ConfigurationPolicyReader ConfigurationPolicyReader;
27 33
28 // Callback for the "requestPolicyData" message. 34 // Callback for the "requestData" message. The parameter |args| is unused.
29 void HandleRequestPolicyData(const ListValue* args); 35 void HandleRequestData(const ListValue* args);
36
37 // Callback for the "fetchPolicy" message. The parameter |args| is unused.
38 void HandleFetchPolicy(const ListValue* args);
39
40 // Send requested data to UI. |is_policy_update| should be set to true when
41 // policy data is pushed to the UI without having been requested by a
42 // javascript message and to false otherwise.
43 void SendDataToUI(bool is_policy_update);
44
45 // Returns a DictionaryValue pointer containing information about the status
46 // of the policy system. The caller acquires ownership of the returned
47 // DictionaryValue pointer.
48 DictionaryValue* GetStatusData();
49
50 // Fetches policy if the appropriate device tokens are available. Returns
51 // true, if any policy was fetched (device or user). Returns false otherwise.
52 bool FetchPolicyIfTokensAvailable();
53
54 // Returns the time at which policy was last fetched by the
55 // CloudPolicySubsystem |subsystem| in string form.
56 string16 GetLastFetchTime(policy::CloudPolicySubsystem* subsystem);
57
58 // Reads the device id from |data_store| and returns it as a string16.
59 string16 GetDeviceId(const policy::CloudPolicyDataStore* data_store);
60
61 // Reads the policy fetch interval from the preferences specified by
62 // |refresh_pref| and returns it as a string16.
63 string16 GetPolicyFetchInterval(const char* refresh_pref);
64
65 // Returns the string corresponding to the CloudPolicySubsystem::ErrorDetails
66 // enum value |error_details|.
67 static string16 CreateStatusMessageString(
68 policy::CloudPolicySubsystem::ErrorDetails error_details);
30 69
31 scoped_ptr<policy::PolicyStatus> policy_status_; 70 scoped_ptr<policy::PolicyStatus> policy_status_;
32 71
33 DISALLOW_COPY_AND_ASSIGN(PolicyUIHandler); 72 DISALLOW_COPY_AND_ASSIGN(PolicyUIHandler);
34 }; 73 };
35 74
36 // The Web UI handler for about:policy. 75 // The Web UI handler for about:policy.
37 class PolicyUI : public ChromeWebUI { 76 class PolicyUI : public ChromeWebUI {
38 public: 77 public:
39 explicit PolicyUI(TabContents* contents); 78 explicit PolicyUI(TabContents* contents);
40 virtual ~PolicyUI(); 79 virtual ~PolicyUI();
41 80
42 private: 81 private:
43 DISALLOW_COPY_AND_ASSIGN(PolicyUI); 82 DISALLOW_COPY_AND_ASSIGN(PolicyUI);
44 }; 83 };
45 84
46 #endif // CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_ 85 #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