Index: chrome/browser/ui/window_snapshot/window_snapshot.cc |
diff --git a/chrome/browser/ui/window_snapshot/window_snapshot.cc b/chrome/browser/ui/window_snapshot/window_snapshot.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ff8759ca132f4556ba24c7b222a97760454200d4 |
--- /dev/null |
+++ b/chrome/browser/ui/window_snapshot/window_snapshot.cc |
@@ -0,0 +1,32 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
+ |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/prefs/pref_service.h" |
+#include "chrome/common/pref_names.h" |
+ |
+namespace chrome { |
+ |
+// Like GrabWindowSnapshot, but does not check if policy settings allow taking |
+// screenshots. Implemented in a platform-specific way. |
+bool GrabWindowSnapshotImpl(gfx::NativeWindow window, |
+ std::vector<unsigned char>* png_representation, |
+ const gfx::Rect& snapshot_bounds); |
+ |
+bool GrabWindowSnapshot( |
+ gfx::NativeWindow window, |
+ std::vector<unsigned char>* png_representation, |
+ const gfx::Rect& snapshot_bounds) { |
+ if (g_browser_process->local_state()->GetBoolean(prefs::kDisableScreenshots)) |
+ return false; |
+ return GrabWindowSnapshotImpl(window, png_representation, snapshot_bounds); |
+} |
+ |
+void RegisterScreenshotPrefs(PrefService* service) { |
+ service->RegisterBooleanPref(prefs::kDisableScreenshots, false); |
+} |
+ |
+} // namespace browser |