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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 const base::FilePath& screenshot_path)> ShowNotificationCallback; | 185 const base::FilePath& screenshot_path)> ShowNotificationCallback; |
186 | 186 |
187 void SaveScreenshotInternal(const ShowNotificationCallback& callback, | 187 void SaveScreenshotInternal(const ShowNotificationCallback& callback, |
188 const base::FilePath& screenshot_path, | 188 const base::FilePath& screenshot_path, |
189 const base::FilePath& local_path, | 189 const base::FilePath& local_path, |
190 scoped_refptr<base::RefCountedBytes> png_data) { | 190 scoped_refptr<base::RefCountedBytes> png_data) { |
191 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 191 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
192 DCHECK(!local_path.empty()); | 192 DCHECK(!local_path.empty()); |
193 ScreenshotTakerObserver::Result result = | 193 ScreenshotTakerObserver::Result result = |
194 ScreenshotTakerObserver::SCREENSHOT_SUCCESS; | 194 ScreenshotTakerObserver::SCREENSHOT_SUCCESS; |
195 if (static_cast<size_t>(file_util::WriteFile( | 195 if (static_cast<size_t>(base::WriteFile( |
196 local_path, | 196 local_path, |
197 reinterpret_cast<char*>(&(png_data->data()[0])), | 197 reinterpret_cast<char*>(&(png_data->data()[0])), |
198 png_data->size())) != png_data->size()) { | 198 png_data->size())) != png_data->size()) { |
199 LOG(ERROR) << "Failed to save to " << local_path.value(); | 199 LOG(ERROR) << "Failed to save to " << local_path.value(); |
200 result = ScreenshotTakerObserver::SCREENSHOT_WRITE_FILE_FAILED; | 200 result = ScreenshotTakerObserver::SCREENSHOT_WRITE_FILE_FAILED; |
201 } | 201 } |
202 content::BrowserThread::PostTask( | 202 content::BrowserThread::PostTask( |
203 content::BrowserThread::UI, FROM_HERE, | 203 content::BrowserThread::UI, FROM_HERE, |
204 base::Bind(callback, result, screenshot_path)); | 204 base::Bind(callback, result, screenshot_path)); |
205 } | 205 } |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 } | 625 } |
626 | 626 |
627 void ScreenshotTaker::SetScreenshotBasenameForTest( | 627 void ScreenshotTaker::SetScreenshotBasenameForTest( |
628 const std::string& basename) { | 628 const std::string& basename) { |
629 screenshot_basename_for_test_ = basename; | 629 screenshot_basename_for_test_ = basename; |
630 } | 630 } |
631 | 631 |
632 void ScreenshotTaker::SetScreenshotProfileForTest(Profile* profile) { | 632 void ScreenshotTaker::SetScreenshotProfileForTest(Profile* profile) { |
633 profile_for_test_ = profile; | 633 profile_for_test_ = profile; |
634 } | 634 } |
OLD | NEW |