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/page_cycler/page_cycler.h" | 5 #include "chrome/browser/page_cycler/page_cycler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 base::Bind(&PageCycler::ReadURLsOnBackgroundThread, this)); | 85 base::Bind(&PageCycler::ReadURLsOnBackgroundThread, this)); |
86 } | 86 } |
87 | 87 |
88 void PageCycler::ReadURLsOnBackgroundThread() { | 88 void PageCycler::ReadURLsOnBackgroundThread() { |
89 CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 89 CHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
90 | 90 |
91 std::string file_contents; | 91 std::string file_contents; |
92 std::vector<std::string> url_strings; | 92 std::vector<std::string> url_strings; |
93 | 93 |
94 CHECK(base::PathExists(urls_file_)) << urls_file_.value(); | 94 CHECK(base::PathExists(urls_file_)) << urls_file_.value(); |
95 file_util::ReadFileToString(urls_file_, &file_contents); | 95 base::ReadFileToString(urls_file_, &file_contents); |
96 base::SplitStringAlongWhitespace(file_contents, &url_strings); | 96 base::SplitStringAlongWhitespace(file_contents, &url_strings); |
97 | 97 |
98 if (!url_strings.size()) { | 98 if (!url_strings.size()) { |
99 #if defined(OS_POSIX) | 99 #if defined(OS_POSIX) |
100 error_.append(ASCIIToUTF16("Page Cycler: No URLs in given file: " + | 100 error_.append(ASCIIToUTF16("Page Cycler: No URLs in given file: " + |
101 urls_file_.value())); | 101 urls_file_.value())); |
102 #elif defined(OS_WIN) | 102 #elif defined(OS_WIN) |
103 error_.append(ASCIIToUTF16("Page Cycler: No URLs in given file: ")) | 103 error_.append(ASCIIToUTF16("Page Cycler: No URLs in given file: ")) |
104 .append(urls_file_.value()); | 104 .append(urls_file_.value()); |
105 #endif // OS_WIN | 105 #endif // OS_WIN |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 aborted_ = true; | 258 aborted_ = true; |
259 error_.append(ASCIIToUTF16( | 259 error_.append(ASCIIToUTF16( |
260 "Browser was closed before the run was completed.")); | 260 "Browser was closed before the run was completed.")); |
261 DLOG(WARNING) << | 261 DLOG(WARNING) << |
262 "Page Cycler: browser was closed before the run was completed."; | 262 "Page Cycler: browser was closed before the run was completed."; |
263 content::BrowserThread::PostBlockingPoolTask( | 263 content::BrowserThread::PostBlockingPoolTask( |
264 FROM_HERE, | 264 FROM_HERE, |
265 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); | 265 base::Bind(&PageCycler::PrepareResultsOnBackgroundThread, this)); |
266 } | 266 } |
267 } | 267 } |
OLD | NEW |