| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/system_notifier.h" | 8 #include "ash/system/system_notifier.h" |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 notification_id, NotificationUIManager::GetProfileID(GetProfile())); | 403 notification_id, NotificationUIManager::GetProfileID(GetProfile())); |
| 404 bool success = | 404 bool success = |
| 405 (screenshot_result == ui::ScreenshotGrabberObserver::SCREENSHOT_SUCCESS); | 405 (screenshot_result == ui::ScreenshotGrabberObserver::SCREENSHOT_SUCCESS); |
| 406 message_center::RichNotificationData optional_field; | 406 message_center::RichNotificationData optional_field; |
| 407 if (success) { | 407 if (success) { |
| 408 const base::string16 label = l10n_util::GetStringUTF16( | 408 const base::string16 label = l10n_util::GetStringUTF16( |
| 409 IDS_MESSAGE_CENTER_NOTIFICATION_BUTTON_COPY_SCREENSHOT_TO_CLIPBOARD); | 409 IDS_MESSAGE_CENTER_NOTIFICATION_BUTTON_COPY_SCREENSHOT_TO_CLIPBOARD); |
| 410 optional_field.buttons.push_back(message_center::ButtonInfo(label)); | 410 optional_field.buttons.push_back(message_center::ButtonInfo(label)); |
| 411 } | 411 } |
| 412 return new Notification( | 412 return new Notification( |
| 413 message_center::NOTIFICATION_TYPE_SIMPLE, GURL(kNotificationOriginUrl), | 413 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 414 l10n_util::GetStringUTF16( | 414 l10n_util::GetStringUTF16( |
| 415 GetScreenshotNotificationTitle(screenshot_result)), | 415 GetScreenshotNotificationTitle(screenshot_result)), |
| 416 l10n_util::GetStringUTF16( | 416 l10n_util::GetStringUTF16( |
| 417 GetScreenshotNotificationText(screenshot_result)), | 417 GetScreenshotNotificationText(screenshot_result)), |
| 418 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 418 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 419 IDR_SCREENSHOT_NOTIFICATION_ICON), | 419 IDR_SCREENSHOT_NOTIFICATION_ICON), |
| 420 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 420 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| 421 ash::system_notifier::kNotifierScreenshot), | 421 ash::system_notifier::kNotifierScreenshot), |
| 422 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_NOTIFIER_SCREENSHOT_NAME), | 422 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_NOTIFIER_SCREENSHOT_NAME), |
| 423 notification_id, optional_field, | 423 GURL(kNotificationOriginUrl), notification_id, optional_field, |
| 424 new ScreenshotGrabberNotificationDelegate(success, GetProfile(), | 424 new ScreenshotGrabberNotificationDelegate(success, GetProfile(), |
| 425 screenshot_path)); | 425 screenshot_path)); |
| 426 } | 426 } |
| 427 #endif | 427 #endif |
| 428 | 428 |
| 429 void ChromeScreenshotGrabber::SetProfileForTest(Profile* profile) { | 429 void ChromeScreenshotGrabber::SetProfileForTest(Profile* profile) { |
| 430 profile_for_test_ = profile; | 430 profile_for_test_ = profile; |
| 431 } | 431 } |
| 432 | 432 |
| 433 Profile* ChromeScreenshotGrabber::GetProfile() { | 433 Profile* ChromeScreenshotGrabber::GetProfile() { |
| 434 return profile_for_test_ ? profile_for_test_ | 434 return profile_for_test_ ? profile_for_test_ |
| 435 : ProfileManager::GetActiveUserProfile(); | 435 : ProfileManager::GetActiveUserProfile(); |
| 436 } | 436 } |
| OLD | NEW |