OLD | NEW |
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 #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/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/policy/browser_policy_connector.h" | 12 #include "chrome/browser/policy/browser_policy_connector.h" |
13 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 13 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
14 #include "chrome/browser/policy/cloud_policy_data_store.h" | 14 #include "chrome/browser/policy/cloud_policy_data_store.h" |
15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 17 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/time_format.h" | 19 #include "chrome/common/time_format.h" |
20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
21 #include "content/browser/tab_contents/tab_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "grit/browser_resources.h" | 22 #include "grit/browser_resources.h" |
23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 | 25 |
26 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
27 #include "chrome/browser/chromeos/login/user_manager.h" | 27 #include "chrome/browser/chromeos/login/user_manager.h" |
28 #endif | 28 #endif |
29 | 29 |
| 30 using content::WebContents; |
| 31 |
30 ChromeWebUIDataSource* CreatePolicyUIHTMLSource() { | 32 ChromeWebUIDataSource* CreatePolicyUIHTMLSource() { |
31 ChromeWebUIDataSource* source = | 33 ChromeWebUIDataSource* source = |
32 new ChromeWebUIDataSource(chrome::kChromeUIPolicyHost); | 34 new ChromeWebUIDataSource(chrome::kChromeUIPolicyHost); |
33 | 35 |
34 // Localized strings. | 36 // Localized strings. |
35 source->AddLocalizedString("policyTitle", IDS_POLICY_TITLE); | 37 source->AddLocalizedString("policyTitle", IDS_POLICY_TITLE); |
36 source->AddLocalizedString("statusPaneTitle", IDS_POLICY_STATUS_TITLE); | 38 source->AddLocalizedString("statusPaneTitle", IDS_POLICY_STATUS_TITLE); |
37 source->AddLocalizedString("fetchPoliciesText", IDS_POLICY_FETCH); | 39 source->AddLocalizedString("fetchPoliciesText", IDS_POLICY_FETCH); |
38 source->AddLocalizedString("devicePoliciesBoxTitle", | 40 source->AddLocalizedString("devicePoliciesBoxTitle", |
39 IDS_POLICY_DEVICE_POLICIES); | 41 IDS_POLICY_DEVICE_POLICIES); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 DCHECK(static_cast<size_t>(error_details) < arraysize(error_to_string_id)); | 225 DCHECK(static_cast<size_t>(error_details) < arraysize(error_to_string_id)); |
224 return l10n_util::GetStringUTF16(error_to_string_id[error_details]); | 226 return l10n_util::GetStringUTF16(error_to_string_id[error_details]); |
225 } | 227 } |
226 | 228 |
227 //////////////////////////////////////////////////////////////////////////////// | 229 //////////////////////////////////////////////////////////////////////////////// |
228 // | 230 // |
229 // PolicyUI | 231 // PolicyUI |
230 // | 232 // |
231 //////////////////////////////////////////////////////////////////////////////// | 233 //////////////////////////////////////////////////////////////////////////////// |
232 | 234 |
233 PolicyUI::PolicyUI(TabContents* contents) : ChromeWebUI(contents) { | 235 PolicyUI::PolicyUI(WebContents* contents) : ChromeWebUI(contents) { |
234 AddMessageHandler(new PolicyUIHandler); | 236 AddMessageHandler(new PolicyUIHandler); |
235 | 237 |
236 // Set up the chrome://policy/ source. | 238 // Set up the chrome://policy/ source. |
237 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 239 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
238 profile->GetChromeURLDataManager()->AddDataSource(CreatePolicyUIHTMLSource()); | 240 profile->GetChromeURLDataManager()->AddDataSource(CreatePolicyUIHTMLSource()); |
239 } | 241 } |
240 | 242 |
241 PolicyUI::~PolicyUI() { | 243 PolicyUI::~PolicyUI() { |
242 } | 244 } |
OLD | NEW |