summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/window_snapshot/window_snapshot.cc
blob: 889d97d57c04d63c9bf23d1abff68334c6610b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h"
#include "ui/snapshot/snapshot.h"

namespace chrome {

bool GrabWindowSnapshotForUser(
    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 ui::GrabWindowSnapshot(window, png_representation,
      snapshot_bounds);
}

void RegisterScreenshotPrefs(PrefRegistrySimple* registry) {
  registry->RegisterBooleanPref(prefs::kDisableScreenshots, false);
}

}  // namespace chrome