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

Unified Diff: chrome/browser/ui/window_snapshot/window_snapshot.cc

Issue 10692110: screenshot disabling policy (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Broken screenshot not visible on feedback page when screenshots are disabled Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
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..ee32095f0b2c868b54d5337230787764260548e5
--- /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 browser {
+
+// The same as GrabWindowSnapshotIfPermitted, but does not check if the
+// operation is permitted by policy settings. Actually this part is fully OS
+// specific, so there's only a declaration here.
Mattias Nissler (ping if slow) 2012/07/13 15:23:42 This comment feels a bit chatty. Just saying "Take
qfel 2012/07/16 09:11:12 Done.
+bool GrabWindowSnapshot(gfx::NativeWindow window,
+ std::vector<unsigned char>* png_representation,
+ const gfx::Rect& snapshot_bounds);
+
+bool GrabWindowSnapshotIfPermitted(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 GrabWindowSnapshot(window, png_representation, snapshot_bounds);
+}
+
+void RegisterScreenshotPrefs(PrefService* service) {
+ service->RegisterBooleanPref(prefs::kDisableScreenshots, false);
+}
+
+} // namespace browser

Powered by Google App Engine
This is Rietveld 408576698