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/about_ui.h" | 5 #include "chrome/browser/ui/webui/about_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 public: | 186 public: |
187 static void Start(AboutUIHTMLSource* source, | 187 static void Start(AboutUIHTMLSource* source, |
188 const std::string& path, | 188 const std::string& path, |
189 int request_id) { | 189 int request_id) { |
190 scoped_refptr<ChromeOSTermsHandler> handler( | 190 scoped_refptr<ChromeOSTermsHandler> handler( |
191 new ChromeOSTermsHandler(source, path, request_id)); | 191 new ChromeOSTermsHandler(source, path, request_id)); |
192 handler->StartOnUIThread(); | 192 handler->StartOnUIThread(); |
193 } | 193 } |
194 | 194 |
195 private: | 195 private: |
| 196 friend class base::RefCountedThreadSafe<ChromeOSTermsHandler>; |
| 197 |
196 ChromeOSTermsHandler(AboutUIHTMLSource* source, | 198 ChromeOSTermsHandler(AboutUIHTMLSource* source, |
197 const std::string& path, | 199 const std::string& path, |
198 int request_id) | 200 int request_id) |
199 : source_(source), | 201 : source_(source), |
200 path_(path), | 202 path_(path), |
201 request_id_(request_id), | 203 request_id_(request_id), |
202 locale_(chromeos::WizardController::GetInitialLocale()) { | 204 locale_(chromeos::WizardController::GetInitialLocale()) { |
203 } | 205 } |
204 | 206 |
| 207 ~ChromeOSTermsHandler() {} |
| 208 |
205 void StartOnUIThread() { | 209 void StartOnUIThread() { |
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
207 BrowserThread::PostTask( | 211 BrowserThread::PostTask( |
208 BrowserThread::FILE, FROM_HERE, | 212 BrowserThread::FILE, FROM_HERE, |
209 base::Bind(&ChromeOSTermsHandler::LoadFileOnFileThread, this)); | 213 base::Bind(&ChromeOSTermsHandler::LoadFileOnFileThread, this)); |
210 } | 214 } |
211 | 215 |
212 void LoadFileOnFileThread() { | 216 void LoadFileOnFileThread() { |
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
214 if (path_ == chrome::kOemEulaURLPath) { | 218 if (path_ == chrome::kOemEulaURLPath) { |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1472 |
1469 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) | 1473 AboutUI::AboutUI(content::WebUI* web_ui, const std::string& name) |
1470 : WebUIController(web_ui) { | 1474 : WebUIController(web_ui) { |
1471 Profile* profile = Profile::FromWebUI(web_ui); | 1475 Profile* profile = Profile::FromWebUI(web_ui); |
1472 ChromeURLDataManager::DataSource* source = | 1476 ChromeURLDataManager::DataSource* source = |
1473 new AboutUIHTMLSource(name, profile); | 1477 new AboutUIHTMLSource(name, profile); |
1474 if (source) { | 1478 if (source) { |
1475 ChromeURLDataManager::AddDataSource(profile, source); | 1479 ChromeURLDataManager::AddDataSource(profile, source); |
1476 } | 1480 } |
1477 } | 1481 } |
OLD | NEW |