Commit 8eefe840 authored by enne@chromium.org's avatar enne@chromium.org

Remove window_snapshot.*

The two simple functions here only have one caller each, so move them
closer to where they are used.

BUG=none

Review URL: https://codereview.chromium.org/132203004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245444 0039d316-1c4b-4281-b951-d872f2087c98
parent 7564aa24
...@@ -91,7 +91,6 @@ ...@@ -91,7 +91,6 @@
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/ui/webui/plugins_ui.h" #include "chrome/browser/ui/webui/plugins_ui.h"
#include "chrome/browser/ui/webui/print_preview/sticky_settings.h" #include "chrome/browser/ui/webui/print_preview/sticky_settings.h"
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "chrome/browser/upgrade_detector.h" #include "chrome/browser/upgrade_detector.h"
#include "chrome/browser/web_resource/promo_resource_service.h" #include "chrome/browser/web_resource/promo_resource_service.h"
#include "chrome/common/metrics/caching_permuted_entropy_provider.h" #include "chrome/common/metrics/caching_permuted_entropy_provider.h"
...@@ -479,6 +478,10 @@ void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { ...@@ -479,6 +478,10 @@ void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
#endif #endif
} }
void RegisterScreenshotPrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kDisableScreenshots, false);
}
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { void RegisterLoginProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
RegisterProfilePrefs(registry); RegisterProfilePrefs(registry);
......
...@@ -18,6 +18,8 @@ namespace chrome { ...@@ -18,6 +18,8 @@ namespace chrome {
// Register all prefs that will be used via the local state PrefService. // Register all prefs that will be used via the local state PrefService.
void RegisterLocalState(PrefRegistrySimple* registry); void RegisterLocalState(PrefRegistrySimple* registry);
void RegisterScreenshotPrefs(PrefRegistrySimple* registry);
// Register all prefs that will be used via a PrefService attached to a user // Register all prefs that will be used via a PrefService attached to a user
// Profile. // Profile.
void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry); void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/user_metrics.h" #include "content/public/browser/user_metrics.h"
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
#include "chrome/browser/ui/panels/panel.h" #include "chrome/browser/ui/panels/panel.h"
#include "chrome/browser/ui/panels/panel_manager.h" #include "chrome/browser/ui/panels/panel_manager.h"
#include "chrome/browser/ui/panels/stacked_panel_collection.h" #include "chrome/browser/ui/panels/stacked_panel_collection.h"
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "ui/base/cocoa/window_size_constants.h" #include "ui/base/cocoa/window_size_constants.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h" #include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/vector2d.h" #include "ui/gfx/vector2d.h"
#include "ui/snapshot/snapshot.h"
// The delegate class to receive the notification from NSViewAnimation. // The delegate class to receive the notification from NSViewAnimation.
@interface BatchBoundsAnimationDelegate : NSObject<NSAnimationDelegate> { @interface BatchBoundsAnimationDelegate : NSObject<NSAnimationDelegate> {
...@@ -300,11 +300,10 @@ void PanelStackWindowCocoa::Minimize() { ...@@ -300,11 +300,10 @@ void PanelStackWindowCocoa::Minimize() {
Panel* panel = *iter; Panel* panel = *iter;
gfx::Rect snapshot_bounds = gfx::Rect(panel->GetBounds().size()); gfx::Rect snapshot_bounds = gfx::Rect(panel->GetBounds().size());
std::vector<unsigned char> png; std::vector<unsigned char> png;
if (!chrome::GrabWindowSnapshotForUser(panel->GetNativeWindow(), if (!ui::GrabWindowSnapshot(panel->GetNativeWindow(),
&png, &png,
snapshot_bounds)) { snapshot_bounds))
break; break;
}
gfx::Image snapshot_image = gfx::Image::CreateFrom1xPNGBytes( gfx::Image snapshot_image = gfx::Image::CreateFrom1xPNGBytes(
&(png[0]), png.size()); &(png[0]), png.size());
canvas.DrawImageInt(snapshot_image.AsImageSkia(), 0, y); canvas.DrawImageInt(snapshot_image.AsImageSkia(), 0, y);
......
// 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
// 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.
#ifndef CHROME_BROWSER_UI_WINDOW_SNAPSHOT_WINDOW_SNAPSHOT_H_
#define CHROME_BROWSER_UI_WINDOW_SNAPSHOT_WINDOW_SNAPSHOT_H_
#include <vector>
#include "ui/gfx/native_widget_types.h"
class PrefRegistrySimple;
namespace gfx {
class Rect;
}
namespace chrome {
void RegisterScreenshotPrefs(PrefRegistrySimple* registry);
// Grabs a snapshot of the rectangle area |snapshot_bounds| with respect to the
// top left corner of the designated window and stores a PNG representation
// into a byte vector. On Windows, |window| may be NULL to grab a snapshot of
// the primary monitor. This takes into account calling user context (ie. checks
// policy settings if taking screenshots is allowed), and is intended to be used
// by browser code. If you need to take a screenshot for debugging purposes,
// consider using ui::GrabWindowSnapshot.
// Returns true if the operation is successful (ie. permitted).
bool GrabWindowSnapshotForUser(gfx::NativeWindow window,
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds);
} // namespace chrome
#endif // CHROME_BROWSER_UI_WINDOW_SNAPSHOT_WINDOW_SNAPSHOT_H_
...@@ -2615,8 +2615,6 @@ ...@@ -2615,8 +2615,6 @@
'browser/ui/window_sizer/window_sizer_aura.cc', 'browser/ui/window_sizer/window_sizer_aura.cc',
'browser/ui/window_sizer/window_sizer_gtk.cc', 'browser/ui/window_sizer/window_sizer_gtk.cc',
'browser/ui/window_sizer/window_sizer_mac.mm', 'browser/ui/window_sizer/window_sizer_mac.mm',
'browser/ui/window_snapshot/window_snapshot.cc',
'browser/ui/window_snapshot/window_snapshot.h',
'browser/ui/zoom/zoom_controller.cc', 'browser/ui/zoom/zoom_controller.cc',
'browser/ui/zoom/zoom_controller.h', 'browser/ui/zoom/zoom_controller.h',
'browser/ui/zoom/zoom_observer.h', 'browser/ui/zoom/zoom_observer.h',
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
#include "ui/base/test/ui_controls.h" #include "ui/base/test/ui_controls.h"
#include "ui/base/win/foreground_helper.h" #include "ui/base/win/foreground_helper.h"
#include "ui/views/focus/focus_manager.h" #include "ui/views/focus/focus_manager.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment