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

Side by Side Diff: chrome/browser/ui/webui/about_ui.cc

Issue 8960010: base::Bind: Convert NewRunnableMethod in chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix 55. Created 9 years 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
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 #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 <vector> 9 #include <vector>
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 : source_(source), 189 : source_(source),
190 path_(path), 190 path_(path),
191 request_id_(request_id), 191 request_id_(request_id),
192 locale_(chromeos::WizardController::GetInitialLocale()) { 192 locale_(chromeos::WizardController::GetInitialLocale()) {
193 } 193 }
194 194
195 void StartOnUIThread() { 195 void StartOnUIThread() {
196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
197 BrowserThread::PostTask( 197 BrowserThread::PostTask(
198 BrowserThread::FILE, FROM_HERE, 198 BrowserThread::FILE, FROM_HERE,
199 NewRunnableMethod(this, &ChromeOSTermsHandler::LoadFileOnFileThread)); 199 base::Bind(&ChromeOSTermsHandler::LoadFileOnFileThread, this));
200 } 200 }
201 201
202 void LoadFileOnFileThread() { 202 void LoadFileOnFileThread() {
203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
204 if (path_ == chrome::kOemEulaURLPath) { 204 if (path_ == chrome::kOemEulaURLPath) {
205 const chromeos::StartupCustomizationDocument* customization = 205 const chromeos::StartupCustomizationDocument* customization =
206 chromeos::StartupCustomizationDocument::GetInstance(); 206 chromeos::StartupCustomizationDocument::GetInstance();
207 if (customization->IsReady()) { 207 if (customization->IsReady()) {
208 FilePath oem_eula_file_path; 208 FilePath oem_eula_file_path;
209 if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)), 209 if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)),
(...skipping 11 matching lines...) Expand all
221 file_path = StringPrintf(chrome::kEULAPathFormat, "en-US"); 221 file_path = StringPrintf(chrome::kEULAPathFormat, "en-US");
222 if (!file_util::ReadFileToString(FilePath(file_path), &contents_)) { 222 if (!file_util::ReadFileToString(FilePath(file_path), &contents_)) {
223 // File with EULA not found, ResponseOnUIThread will load EULA from 223 // File with EULA not found, ResponseOnUIThread will load EULA from
224 // resources if contents_ is empty. 224 // resources if contents_ is empty.
225 contents_.clear(); 225 contents_.clear();
226 } 226 }
227 } 227 }
228 } 228 }
229 BrowserThread::PostTask( 229 BrowserThread::PostTask(
230 BrowserThread::UI, FROM_HERE, 230 BrowserThread::UI, FROM_HERE,
231 NewRunnableMethod(this, &ChromeOSTermsHandler::ResponseOnUIThread)); 231 base::Bind(&ChromeOSTermsHandler::ResponseOnUIThread, this));
232 } 232 }
233 233
234 void ResponseOnUIThread() { 234 void ResponseOnUIThread() {
235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
236 // If we fail to load Chrome OS EULA from disk, load it from resources. 236 // If we fail to load Chrome OS EULA from disk, load it from resources.
237 // Do nothing if OEM EULA load failed. 237 // Do nothing if OEM EULA load failed.
238 if (contents_.empty() && path_ != chrome::kOemEulaURLPath) { 238 if (contents_.empty() && path_ != chrome::kOemEulaURLPath) {
239 contents_ = ResourceBundle::GetSharedInstance().GetRawDataResource( 239 contents_ = ResourceBundle::GetSharedInstance().GetRawDataResource(
240 IDR_TERMS_HTML).as_string(); 240 IDR_TERMS_HTML).as_string();
241 } 241 }
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 631 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
632 } 632 }
633 633
634 // Calls FinishOnUIThread() on completion. 634 // Calls FinishOnUIThread() on completion.
635 void StartOnUIThread() { 635 void StartOnUIThread() {
636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
637 chrome_browser_net::Predictor* predictor = 637 chrome_browser_net::Predictor* predictor =
638 source_->profile()->GetNetworkPredictor(); 638 source_->profile()->GetNetworkPredictor();
639 BrowserThread::PostTask( 639 BrowserThread::PostTask(
640 BrowserThread::IO, FROM_HERE, 640 BrowserThread::IO, FROM_HERE,
641 NewRunnableMethod(this, &AboutDnsHandler::StartOnIOThread, predictor)); 641 base::Bind(&AboutDnsHandler::StartOnIOThread, this, predictor));
642 } 642 }
643 643
644 void StartOnIOThread(chrome_browser_net::Predictor* predictor) { 644 void StartOnIOThread(chrome_browser_net::Predictor* predictor) {
645 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 645 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
646 646
647 std::string data; 647 std::string data;
648 AppendHeader(&data, 0, "About DNS"); 648 AppendHeader(&data, 0, "About DNS");
649 AppendBody(&data); 649 AppendBody(&data);
650 chrome_browser_net::Predictor::PredictorGetHtmlInfo(predictor, &data); 650 chrome_browser_net::Predictor::PredictorGetHtmlInfo(predictor, &data);
651 AppendFooter(&data); 651 AppendFooter(&data);
652 652
653 BrowserThread::PostTask( 653 BrowserThread::PostTask(
654 BrowserThread::UI, FROM_HERE, 654 BrowserThread::UI, FROM_HERE,
655 NewRunnableMethod(this, &AboutDnsHandler::FinishOnUIThread, data)); 655 base::Bind(&AboutDnsHandler::FinishOnUIThread, this, data));
656 } 656 }
657 657
658 void FinishOnUIThread(const std::string& data) { 658 void FinishOnUIThread(const std::string& data) {
659 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 659 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
660 source_->FinishDataRequest(data, request_id_); 660 source_->FinishDataRequest(data, request_id_);
661 } 661 }
662 662
663 // Where the results are fed to. 663 // Where the results are fed to.
664 scoped_refptr<AboutUIHTMLSource> source_; 664 scoped_refptr<AboutUIHTMLSource> source_;
665 665
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 } 1378 }
1379 1379
1380 AboutUI::AboutUI(TabContents* contents, const std::string& name) 1380 AboutUI::AboutUI(TabContents* contents, const std::string& name)
1381 : ChromeWebUI(contents) { 1381 : ChromeWebUI(contents) {
1382 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); 1382 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext());
1383 ChromeURLDataManager::DataSource* source = 1383 ChromeURLDataManager::DataSource* source =
1384 new AboutUIHTMLSource(name, profile); 1384 new AboutUIHTMLSource(name, profile);
1385 if (source) 1385 if (source)
1386 profile->GetChromeURLDataManager()->AddDataSource(source); 1386 profile->GetChromeURLDataManager()->AddDataSource(source);
1387 } 1387 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service_unittest.cc ('k') | chrome/browser/ui/webui/chrome_url_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698