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/ash/screenshot_taker.h" | 5 #include "chrome/browser/ui/ash/screenshot_taker.h" |
6 | 6 |
7 #include <climits> | 7 #include <climits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 content::BrowserThread::UI, FROM_HERE, | 207 content::BrowserThread::UI, FROM_HERE, |
208 base::Bind(callback, result, screenshot_path)); | 208 base::Bind(callback, result, screenshot_path)); |
209 } | 209 } |
210 | 210 |
211 void SaveScreenshot(const ShowNotificationCallback& callback, | 211 void SaveScreenshot(const ShowNotificationCallback& callback, |
212 const base::FilePath& screenshot_path, | 212 const base::FilePath& screenshot_path, |
213 scoped_refptr<base::RefCountedBytes> png_data) { | 213 scoped_refptr<base::RefCountedBytes> png_data) { |
214 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 214 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
215 DCHECK(!screenshot_path.empty()); | 215 DCHECK(!screenshot_path.empty()); |
216 | 216 |
217 if (!file_util::CreateDirectory(screenshot_path.DirName())) { | 217 if (!base::CreateDirectory(screenshot_path.DirName())) { |
218 LOG(ERROR) << "Failed to ensure the existence of " | 218 LOG(ERROR) << "Failed to ensure the existence of " |
219 << screenshot_path.DirName().value(); | 219 << screenshot_path.DirName().value(); |
220 content::BrowserThread::PostTask( | 220 content::BrowserThread::PostTask( |
221 content::BrowserThread::UI, FROM_HERE, | 221 content::BrowserThread::UI, FROM_HERE, |
222 base::Bind(callback, | 222 base::Bind(callback, |
223 ScreenshotTakerObserver::SCREENSHOT_CREATE_DIR_FAILED, | 223 ScreenshotTakerObserver::SCREENSHOT_CREATE_DIR_FAILED, |
224 screenshot_path)); | 224 screenshot_path)); |
225 return; | 225 return; |
226 } | 226 } |
227 SaveScreenshotInternal(callback, screenshot_path, screenshot_path, png_data); | 227 SaveScreenshotInternal(callback, screenshot_path, screenshot_path, png_data); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 } | 591 } |
592 | 592 |
593 void ScreenshotTaker::SetScreenshotBasenameForTest( | 593 void ScreenshotTaker::SetScreenshotBasenameForTest( |
594 const std::string& basename) { | 594 const std::string& basename) { |
595 screenshot_basename_for_test_ = basename; | 595 screenshot_basename_for_test_ = basename; |
596 } | 596 } |
597 | 597 |
598 void ScreenshotTaker::SetScreenshotProfileForTest(Profile* profile) { | 598 void ScreenshotTaker::SetScreenshotProfileForTest(Profile* profile) { |
599 profile_for_test_ = profile; | 599 profile_for_test_ = profile; |
600 } | 600 } |
OLD | NEW |