| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 screenshot_path, | 123 screenshot_path, |
| 124 reinterpret_cast<char*>(&(png_data->data()[0])), | 124 reinterpret_cast<char*>(&(png_data->data()[0])), |
| 125 png_data->size())) != png_data->size()) { | 125 png_data->size())) != png_data->size()) { |
| 126 LOG(ERROR) << "Failed to save to " << screenshot_path.value(); | 126 LOG(ERROR) << "Failed to save to " << screenshot_path.value(); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 // TODO(kinaba): crbug.com/140425, remove this ungly #ifdef dispatch. | 130 // TODO(kinaba): crbug.com/140425, remove this ungly #ifdef dispatch. |
| 131 #ifdef OS_CHROMEOS | 131 #ifdef OS_CHROMEOS |
| 132 void SaveScreenshotToGData(scoped_refptr<base::RefCountedBytes> png_data, | 132 void SaveScreenshotToGData(scoped_refptr<base::RefCountedBytes> png_data, |
| 133 gdata::GDataFileError error, | 133 gdata::DriveFileError error, |
| 134 const FilePath& local_path) { | 134 const FilePath& local_path) { |
| 135 if (error != gdata::GDATA_FILE_OK) { | 135 if (error != gdata::DRIVE_FILE_OK) { |
| 136 LOG(ERROR) << "Failed to write screenshot image to Google Drive: " << error; | 136 LOG(ERROR) << "Failed to write screenshot image to Google Drive: " << error; |
| 137 return; | 137 return; |
| 138 } | 138 } |
| 139 SaveScreenshot(local_path, png_data); | 139 SaveScreenshot(local_path, png_data); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PostSaveScreenshotTask(const FilePath& screenshot_path, | 142 void PostSaveScreenshotTask(const FilePath& screenshot_path, |
| 143 scoped_refptr<base::RefCountedBytes> png_data) { | 143 scoped_refptr<base::RefCountedBytes> png_data) { |
| 144 if (gdata::util::IsUnderGDataMountPoint(screenshot_path)) { | 144 if (gdata::util::IsUnderGDataMountPoint(screenshot_path)) { |
| 145 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); | 145 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 ash::internal::kShellWindowId_OverlayContainer)->layer(); | 259 ash::internal::kShellWindowId_OverlayContainer)->layer(); |
| 260 parent->Add(visual_feedback_layer_.get()); | 260 parent->Add(visual_feedback_layer_.get()); |
| 261 visual_feedback_layer_->SetVisible(true); | 261 visual_feedback_layer_->SetVisible(true); |
| 262 | 262 |
| 263 MessageLoopForUI::current()->PostDelayedTask( | 263 MessageLoopForUI::current()->PostDelayedTask( |
| 264 FROM_HERE, | 264 FROM_HERE, |
| 265 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer, | 265 base::Bind(&ScreenshotTaker::CloseVisualFeedbackLayer, |
| 266 base::Unretained(this)), | 266 base::Unretained(this)), |
| 267 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs)); | 267 base::TimeDelta::FromMilliseconds(kVisualFeedbackLayerDisplayTimeMs)); |
| 268 } | 268 } |
| OLD | NEW |