| Index: chrome/browser/ui/views/ash/screenshot_taker.cc
|
| diff --git a/chrome/browser/ui/views/ash/screenshot_taker.cc b/chrome/browser/ui/views/ash/screenshot_taker.cc
|
| index 9549e2c964b6939ee9d18296c559c61aa3bc6e39..6b49148b88a713d463dea0182105c8cf10f1871a 100644
|
| --- a/chrome/browser/ui/views/ash/screenshot_taker.cc
|
| +++ b/chrome/browser/ui/views/ash/screenshot_taker.cc
|
| @@ -18,6 +18,7 @@
|
| #include "base/memory/ref_counted_memory.h"
|
| #include "base/stringprintf.h"
|
| #include "base/time.h"
|
| +#include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/download/download_prefs.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -109,10 +110,16 @@ void SaveScreenshot(const FilePath& screenshot_directory,
|
| }
|
| }
|
|
|
| -bool GrabWindowSnapshot(aura::Window* window,
|
| +bool GrabWindowSnapshotIfPermitted(aura::Window* window,
|
| const gfx::Rect& snapshot_bounds,
|
| std::vector<unsigned char>* png_data) {
|
| #if defined(OS_LINUX)
|
| + // browser::GrabWindowSnapshotIfPermitted checks this too,
|
| + // but RootWindow::GrabSnapshot does not. The statement below is only to
|
| + // support linux-specific XGetImage optimization.
|
| + if (g_browser_process->local_state()->GetBoolean(prefs::kDisableScreenshots))
|
| + return false;
|
| +
|
| // We use XGetImage() for Linux/ChromeOS for performance reasons.
|
| // See crbug.com/119492
|
| // TODO(mukai): remove this when the performance issue has been fixed.
|
| @@ -120,7 +127,8 @@ bool GrabWindowSnapshot(aura::Window* window,
|
| return true;
|
| #endif // OS_LINUX
|
|
|
| - return browser::GrabWindowSnapshot(window, png_data, snapshot_bounds);
|
| + return browser::GrabWindowSnapshotIfPermitted(window, png_data,
|
| + snapshot_bounds);
|
| }
|
|
|
| // How opaque should the layer that we flash onscreen to provide visual
|
| @@ -163,7 +171,7 @@ void ScreenshotTaker::HandleTakePartialScreenshot(
|
|
|
| bool use_24hour_clock = ShouldUse24HourClock();
|
|
|
| - if (GrabWindowSnapshot(window, rect, &png_data->data())) {
|
| + if (GrabWindowSnapshotIfPermitted(window, rect, &png_data->data())) {
|
| DisplayVisualFeedback(rect);
|
| content::BrowserThread::PostTask(
|
| content::BrowserThread::FILE, FROM_HERE,
|
|
|