| 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/nacl_ui.h" | 5 #include "chrome/browser/ui/webui/nacl_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 base::Bind(&NaClDomHandlerProxy::ValidatePnaclPath, this)); | 155 base::Bind(&NaClDomHandlerProxy::ValidatePnaclPath, this)); |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 | 158 |
| 159 base::FilePath pnacl_path; | 159 base::FilePath pnacl_path; |
| 160 bool got_path = PathService::Get(chrome::DIR_PNACL_COMPONENT, &pnacl_path); | 160 bool got_path = PathService::Get(chrome::DIR_PNACL_COMPONENT, &pnacl_path); |
| 161 // The PathService may return an empty string if PNaCl is not yet installed. | 161 // The PathService may return an empty string if PNaCl is not yet installed. |
| 162 // However, do not trust that the path returned by the PathService exists. | 162 // However, do not trust that the path returned by the PathService exists. |
| 163 // Check for existence here. | 163 // Check for existence here. |
| 164 ValidatePnaclPathCallback( | 164 ValidatePnaclPathCallback( |
| 165 got_path && !pnacl_path.empty() && file_util::PathExists(pnacl_path)); | 165 got_path && !pnacl_path.empty() && base::PathExists(pnacl_path)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void NaClDomHandlerProxy::ValidatePnaclPathCallback(bool is_valid) { | 168 void NaClDomHandlerProxy::ValidatePnaclPathCallback(bool is_valid) { |
| 169 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 169 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 170 BrowserThread::PostTask( | 170 BrowserThread::PostTask( |
| 171 BrowserThread::UI, FROM_HERE, | 171 BrowserThread::UI, FROM_HERE, |
| 172 base::Bind(&NaClDomHandlerProxy::ValidatePnaclPathCallback, | 172 base::Bind(&NaClDomHandlerProxy::ValidatePnaclPathCallback, |
| 173 this, is_valid)); | 173 this, is_valid)); |
| 174 return; | 174 return; |
| 175 } | 175 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 377 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 378 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); | 378 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); |
| 379 | 379 |
| 380 web_ui->AddMessageHandler(new NaClDomHandler()); | 380 web_ui->AddMessageHandler(new NaClDomHandler()); |
| 381 | 381 |
| 382 // Set up the about:nacl source. | 382 // Set up the about:nacl source. |
| 383 Profile* profile = Profile::FromWebUI(web_ui); | 383 Profile* profile = Profile::FromWebUI(web_ui); |
| 384 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); | 384 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); |
| 385 } | 385 } |
| OLD | NEW |