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..b4e657f878ebd302b588deafa74292543193205f |
--- /dev/null |
+++ b/chrome/browser/ui/window_snapshot/window_snapshot.cc |
@@ -0,0 +1,43 @@ |
+// 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 "base/logging.h" |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/prefs/pref_service.h" |
+#include "chrome/common/pref_names.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
+#include "ui/aura/window.h" |
+#include "ui/compositor/compositor.h" |
+#include "ui/compositor/dip_util.h" |
+#include "ui/compositor/layer.h" |
+#include "ui/gfx/codec/png_codec.h" |
+#include "ui/gfx/rect.h" |
Mattias Nissler (ping if slow)
2012/07/12 08:59:32
Please clean up the list of includes to contain on
qfel
2012/07/12 14:48:06
Done.
|
+ |
+namespace browser { |
+ |
+// OS specific implementation part of GrabWindowSnapshot (defined in |
+// window_snapshot_*.cc). |
+bool GrabWindowSnapshotOS(gfx::NativeWindow window, |
Mattias Nissler (ping if slow)
2012/07/12 08:59:32
I don't really like this name. Maybe keep the exis
qfel
2012/07/12 14:48:06
Done.
|
+ std::vector<unsigned char>* png_representation, |
Mattias Nissler (ping if slow)
2012/07/12 08:59:32
indentation.
qfel
2012/07/12 14:48:06
Done.
|
+ const gfx::Rect& snapshot_bounds); |
+ |
+bool GrabWindowSnapshot(gfx::NativeWindow window, |
+ std::vector<unsigned char>* png_representation, |
+ const gfx::Rect& snapshot_bounds) { |
+#if defined(OS_CHROMEOS) |
Mattias Nissler (ping if slow)
2012/07/12 08:59:32
should this really be OS_CHROMEOS only? What are t
qfel
2012/07/12 14:48:06
Now the policy fully works on every platform.
Done
|
+ if (g_browser_process->local_state()->GetBoolean(prefs::kDisableScreenshots)) |
+ return false; |
+#endif |
+ return GrabWindowSnapshotOS(window, png_representation, snapshot_bounds); |
+} |
+ |
+#if defined(OS_CHROMEOS) |
+void RegisterPrefs(PrefService* service) { |
+ service->RegisterBooleanPref(prefs::kDisableScreenshots, false); |
+} |
+#endif |
+ |
+} // namespace browser |