OLD | NEW |
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.h" | 5 #include "chrome/browser/ui/webui/policy_ui.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 //////////////////////////////////////////////////////////////////////////////// | 164 //////////////////////////////////////////////////////////////////////////////// |
165 // | 165 // |
166 // PolicyUIHandler | 166 // PolicyUIHandler |
167 // | 167 // |
168 //////////////////////////////////////////////////////////////////////////////// | 168 //////////////////////////////////////////////////////////////////////////////// |
169 | 169 |
170 PolicyUIHandler::PolicyUIHandler() | 170 PolicyUIHandler::PolicyUIHandler() |
171 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} | 171 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} |
172 | 172 |
173 PolicyUIHandler::~PolicyUIHandler() { | 173 PolicyUIHandler::~PolicyUIHandler() { |
174 GetPolicyService()->RemoveObserver( | 174 GetPolicyService()->RemoveObserver(policy::POLICY_DOMAIN_CHROME, this); |
175 policy::POLICY_DOMAIN_CHROME, "", this); | |
176 } | 175 } |
177 | 176 |
178 void PolicyUIHandler::RegisterMessages() { | 177 void PolicyUIHandler::RegisterMessages() { |
179 GetPolicyService()->AddObserver( | 178 GetPolicyService()->AddObserver(policy::POLICY_DOMAIN_CHROME, this); |
180 policy::POLICY_DOMAIN_CHROME, "", this); | |
181 web_ui()->RegisterMessageCallback( | 179 web_ui()->RegisterMessageCallback( |
182 "requestData", | 180 "requestData", |
183 base::Bind(&PolicyUIHandler::HandleRequestData, | 181 base::Bind(&PolicyUIHandler::HandleRequestData, |
184 base::Unretained(this))); | 182 base::Unretained(this))); |
185 web_ui()->RegisterMessageCallback( | 183 web_ui()->RegisterMessageCallback( |
186 "fetchPolicy", | 184 "fetchPolicy", |
187 base::Bind(&PolicyUIHandler::HandleFetchPolicy, | 185 base::Bind(&PolicyUIHandler::HandleFetchPolicy, |
188 base::Unretained(this))); | 186 base::Unretained(this))); |
189 } | 187 } |
190 | 188 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 372 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
375 web_ui->AddMessageHandler(new PolicyUIHandler); | 373 web_ui->AddMessageHandler(new PolicyUIHandler); |
376 | 374 |
377 // Set up the chrome://policy/ source. | 375 // Set up the chrome://policy/ source. |
378 Profile* profile = Profile::FromWebUI(web_ui); | 376 Profile* profile = Profile::FromWebUI(web_ui); |
379 ChromeURLDataManager::AddDataSource(profile, CreatePolicyUIHTMLSource()); | 377 ChromeURLDataManager::AddDataSource(profile, CreatePolicyUIHTMLSource()); |
380 } | 378 } |
381 | 379 |
382 PolicyUI::~PolicyUI() { | 380 PolicyUI::~PolicyUI() { |
383 } | 381 } |
OLD | NEW |