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

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: . 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.
Mattias Nissler (ping if slow) 2011/09/07 12:50:48 Mention ownership transfer.
simo 2011/09/07 14:52:58 Done.
47 DictionaryValue* GetStatusData();
48
49 // Fetches policy if the appropriate device tokens are available. Returns
50 // true, if any policy was fetched (device or user). Returns false otherwise.
51 bool FetchPolicyIfTokensAvailable();
52
53 // Returns the time at which policy was last fetched by the
54 // CloudPolicySubsystem |subsystem| in string form.
55 string16 GetLastFetchTime(policy::CloudPolicySubsystem* subsystem);
56
57 // Reads the device id from |data_store| and returns it as a string16.
58 string16 GetDeviceId(const policy::CloudPolicyDataStore* data_store);
59
60 // Reads the policy fetch interval from the preferences specified by
61 // |refresh_pref| and returns it as a string16.
62 string16 GetPolicyFetchInterval(const char* refresh_pref);
63
64 // Returns the string corresponding to the CloudPolicySubsystem::ErrorDetails
65 // enum value |error_details|.
66 static string16 CreateStatusMessageString(
67 policy::CloudPolicySubsystem::ErrorDetails error_details);
30 68
31 scoped_ptr<policy::PolicyStatus> policy_status_; 69 scoped_ptr<policy::PolicyStatus> policy_status_;
32 70
33 DISALLOW_COPY_AND_ASSIGN(PolicyUIHandler); 71 DISALLOW_COPY_AND_ASSIGN(PolicyUIHandler);
34 }; 72 };
35 73
36 // The Web UI handler for about:policy. 74 // The Web UI handler for about:policy.
37 class PolicyUI : public ChromeWebUI { 75 class PolicyUI : public ChromeWebUI {
38 public: 76 public:
39 explicit PolicyUI(TabContents* contents); 77 explicit PolicyUI(TabContents* contents);
40 virtual ~PolicyUI(); 78 virtual ~PolicyUI();
41 79
42 private: 80 private:
43 DISALLOW_COPY_AND_ASSIGN(PolicyUI); 81 DISALLOW_COPY_AND_ASSIGN(PolicyUI);
44 }; 82 };
45 83
46 #endif // CHROME_BROWSER_UI_WEBUI_POLICY_UI_H_ 84 #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