| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_screenshot_grabber.h" | 5 #include "chrome/browser/ui/ash/chrome_screenshot_grabber.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/system/system_notifier.h" | 10 #include "ash/system/system_notifier.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 << screenshot_path.value(); | 83 << screenshot_path.value(); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 | 86 |
| 87 content::BrowserThread::PostTask( | 87 content::BrowserThread::PostTask( |
| 88 content::BrowserThread::UI, FROM_HERE, | 88 content::BrowserThread::UI, FROM_HERE, |
| 89 base::Bind(CopyScreenshotToClipboard, png_data)); | 89 base::Bind(CopyScreenshotToClipboard, png_data)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
| 93 void ReadFileAndCopyToClipboardDrive(drive::FileError error, | 93 void ReadFileAndCopyToClipboardDrive( |
| 94 const base::FilePath& file_path, | 94 drive::FileError error, |
| 95 scoped_ptr<drive::ResourceEntry> entry) { | 95 const base::FilePath& file_path, |
| 96 std::unique_ptr<drive::ResourceEntry> entry) { |
| 96 if (error != drive::FILE_ERROR_OK) { | 97 if (error != drive::FILE_ERROR_OK) { |
| 97 LOG(ERROR) << "Failed to read the screenshot path on drive: " | 98 LOG(ERROR) << "Failed to read the screenshot path on drive: " |
| 98 << drive::FileErrorToString(error); | 99 << drive::FileErrorToString(error); |
| 99 return; | 100 return; |
| 100 } | 101 } |
| 101 content::BrowserThread::GetBlockingPool()->PostTask( | 102 content::BrowserThread::GetBlockingPool()->PostTask( |
| 102 FROM_HERE, base::Bind(&ReadFileAndCopyToClipboardLocal, file_path)); | 103 FROM_HERE, base::Bind(&ReadFileAndCopyToClipboardLocal, file_path)); |
| 103 } | 104 } |
| 104 #endif | 105 #endif |
| 105 | 106 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // after he logs in (crbug.com/235217). | 381 // after he logs in (crbug.com/235217). |
| 381 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) | 382 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) |
| 382 return; | 383 return; |
| 383 | 384 |
| 384 // TODO(sschmitz): make this work for Windows. | 385 // TODO(sschmitz): make this work for Windows. |
| 385 NotifierStateTracker* const notifier_state_tracker = | 386 NotifierStateTracker* const notifier_state_tracker = |
| 386 NotifierStateTrackerFactory::GetForProfile(GetProfile()); | 387 NotifierStateTrackerFactory::GetForProfile(GetProfile()); |
| 387 if (notifier_state_tracker->IsNotifierEnabled(message_center::NotifierId( | 388 if (notifier_state_tracker->IsNotifierEnabled(message_center::NotifierId( |
| 388 message_center::NotifierId::SYSTEM_COMPONENT, | 389 message_center::NotifierId::SYSTEM_COMPONENT, |
| 389 ash::system_notifier::kNotifierScreenshot))) { | 390 ash::system_notifier::kNotifierScreenshot))) { |
| 390 scoped_ptr<Notification> notification( | 391 std::unique_ptr<Notification> notification( |
| 391 CreateNotification(result, screenshot_path)); | 392 CreateNotification(result, screenshot_path)); |
| 392 g_browser_process->notification_ui_manager()->Add(*notification, | 393 g_browser_process->notification_ui_manager()->Add(*notification, |
| 393 GetProfile()); | 394 GetProfile()); |
| 394 } | 395 } |
| 395 #endif | 396 #endif |
| 396 } | 397 } |
| 397 | 398 |
| 398 #if defined(OS_CHROMEOS) | 399 #if defined(OS_CHROMEOS) |
| 399 Notification* ChromeScreenshotGrabber::CreateNotification( | 400 Notification* ChromeScreenshotGrabber::CreateNotification( |
| 400 ui::ScreenshotGrabberObserver::Result screenshot_result, | 401 ui::ScreenshotGrabberObserver::Result screenshot_result, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 430 #endif | 431 #endif |
| 431 | 432 |
| 432 void ChromeScreenshotGrabber::SetProfileForTest(Profile* profile) { | 433 void ChromeScreenshotGrabber::SetProfileForTest(Profile* profile) { |
| 433 profile_for_test_ = profile; | 434 profile_for_test_ = profile; |
| 434 } | 435 } |
| 435 | 436 |
| 436 Profile* ChromeScreenshotGrabber::GetProfile() { | 437 Profile* ChromeScreenshotGrabber::GetProfile() { |
| 437 return profile_for_test_ ? profile_for_test_ | 438 return profile_for_test_ ? profile_for_test_ |
| 438 : ProfileManager::GetActiveUserProfile(); | 439 : ProfileManager::GetActiveUserProfile(); |
| 439 } | 440 } |
| OLD | NEW |