Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: trunk/src/chrome/browser/ui/ash/screenshot_taker.cc

Issue 276773004: Revert 269892 "linux_aura: Compile ash into chrome." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chromeos/login/login_state.h" 51 #include "chromeos/login/login_state.h"
52 #endif 52 #endif
53 53
54 namespace { 54 namespace {
55 // The minimum interval between two screenshot commands. It has to be 55 // The minimum interval between two screenshot commands. It has to be
56 // more than 1000 to prevent the conflict of filenames. 56 // more than 1000 to prevent the conflict of filenames.
57 const int kScreenshotMinimumIntervalInMS = 1000; 57 const int kScreenshotMinimumIntervalInMS = 1000;
58 58
59 const char kNotificationId[] = "screenshot"; 59 const char kNotificationId[] = "screenshot";
60 60
61 #if defined(OS_CHROMEOS)
62 const char kNotificationOriginUrl[] = "chrome://screenshot"; 61 const char kNotificationOriginUrl[] = "chrome://screenshot";
63 #endif
64 62
65 const char kImageClipboardFormatPrefix[] = "<img src='data:image/png;base64,"; 63 const char kImageClipboardFormatPrefix[] = "<img src='data:image/png;base64,";
66 const char kImageClipboardFormatSuffix[] = "'>"; 64 const char kImageClipboardFormatSuffix[] = "'>";
67 65
68 void CopyScreenshotToClipboard(scoped_refptr<base::RefCountedString> png_data) { 66 void CopyScreenshotToClipboard(scoped_refptr<base::RefCountedString> png_data) {
69 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 67 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
70 68
71 std::string encoded; 69 std::string encoded;
72 base::Base64Encode(png_data->data(), &encoded); 70 base::Base64Encode(png_data->data(), &encoded);
73 71
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 *directory = download_prefs->DownloadPath(); 352 *directory = download_prefs->DownloadPath();
355 } else { 353 } else {
356 if (!base::GetTempDir(directory)) { 354 if (!base::GetTempDir(directory)) {
357 LOG(ERROR) << "Failed to find temporary directory."; 355 LOG(ERROR) << "Failed to find temporary directory.";
358 return false; 356 return false;
359 } 357 }
360 } 358 }
361 return true; 359 return true;
362 } 360 }
363 361
364 #if defined(OS_CHROMEOS)
365 const int GetScreenshotNotificationTitle( 362 const int GetScreenshotNotificationTitle(
366 ScreenshotTakerObserver::Result screenshot_result) { 363 ScreenshotTakerObserver::Result screenshot_result) {
367 switch (screenshot_result) { 364 switch (screenshot_result) {
368 case ScreenshotTakerObserver::SCREENSHOTS_DISABLED: 365 case ScreenshotTakerObserver::SCREENSHOTS_DISABLED:
369 return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_DISABLED; 366 return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_DISABLED;
370 case ScreenshotTakerObserver::SCREENSHOT_SUCCESS: 367 case ScreenshotTakerObserver::SCREENSHOT_SUCCESS:
371 return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_SUCCESS; 368 return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_SUCCESS;
372 default: 369 default:
373 return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_FAIL; 370 return IDS_ASH_SCREENSHOT_NOTIFICATION_TITLE_FAIL;
374 } 371 }
375 } 372 }
376 373
377 const int GetScreenshotNotificationText( 374 const int GetScreenshotNotificationText(
378 ScreenshotTakerObserver::Result screenshot_result) { 375 ScreenshotTakerObserver::Result screenshot_result) {
379 switch (screenshot_result) { 376 switch (screenshot_result) {
380 case ScreenshotTakerObserver::SCREENSHOTS_DISABLED: 377 case ScreenshotTakerObserver::SCREENSHOTS_DISABLED:
381 return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_DISABLED; 378 return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_DISABLED;
382 case ScreenshotTakerObserver::SCREENSHOT_SUCCESS: 379 case ScreenshotTakerObserver::SCREENSHOT_SUCCESS:
383 return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_SUCCESS; 380 return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_SUCCESS;
384 default: 381 default:
385 return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_FAIL; 382 return IDS_ASH_SCREENSHOT_NOTIFICATION_TEXT_FAIL;
386 } 383 }
387 } 384 }
388 #endif
389 385
390 } // namespace 386 } // namespace
391 387
392 ScreenshotTaker::ScreenshotTaker() 388 ScreenshotTaker::ScreenshotTaker()
393 : factory_(this), 389 : factory_(this),
394 profile_for_test_(NULL) { 390 profile_for_test_(NULL) {
395 } 391 }
396 392
397 ScreenshotTaker::~ScreenshotTaker() { 393 ScreenshotTaker::~ScreenshotTaker() {
398 } 394 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 } 623 }
628 624
629 void ScreenshotTaker::SetScreenshotBasenameForTest( 625 void ScreenshotTaker::SetScreenshotBasenameForTest(
630 const std::string& basename) { 626 const std::string& basename) {
631 screenshot_basename_for_test_ = basename; 627 screenshot_basename_for_test_ = basename;
632 } 628 }
633 629
634 void ScreenshotTaker::SetScreenshotProfileForTest(Profile* profile) { 630 void ScreenshotTaker::SetScreenshotProfileForTest(Profile* profile) {
635 profile_for_test_ = profile; 631 profile_for_test_ = profile;
636 } 632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698