Commit df52d2b6 authored by tfarina@chromium.org's avatar tfarina@chromium.org

chrome: Put window_snapshot into chrome namespace.

BUG=133088
TBR=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10826011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148696 0039d316-1c4b-4281-b951-d872f2087c98
parent 6204f208
......@@ -122,7 +122,7 @@ bool GrabWindowSnapshot(aura::Window* window,
return true;
#endif // OS_LINUX
return browser::GrabWindowSnapshot(window, png_data, snapshot_bounds);
return chrome::GrabWindowSnapshot(window, png_data, snapshot_bounds);
}
// How opaque should the layer that we flash onscreen to provide visual
......
......@@ -13,8 +13,8 @@
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/feedback/feedback_data.h"
......@@ -168,9 +168,9 @@ void ShowWebFeedbackView(Browser* browser,
native_window = browser->window()->GetNativeWindow();
snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size());
#endif
bool success = browser::GrabWindowSnapshot(native_window,
last_screenshot_png,
snapshot_bounds);
bool success = chrome::GrabWindowSnapshot(native_window,
last_screenshot_png,
snapshot_bounds);
FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect());
std::string feedback_url = std::string(chrome::kChromeUIFeedbackURL) + "?" +
......
......@@ -10,10 +10,10 @@
#include "ui/gfx/native_widget_types.h"
namespace gfx {
class Rect;
class Rect;
}
namespace browser {
namespace chrome {
// 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
......@@ -23,6 +23,6 @@ bool GrabWindowSnapshot(gfx::NativeWindow window,
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds);
} // namespace browser
} // namespace chrome
#endif // CHROME_BROWSER_UI_WINDOW_SNAPSHOT_WINDOW_SNAPSHOT_H_
......@@ -13,7 +13,7 @@
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/rect.h"
namespace browser {
namespace chrome {
bool GrabWindowSnapshot(gfx::NativeWindow window,
std::vector<unsigned char>* png_representation,
......@@ -48,4 +48,4 @@ bool GrabWindowSnapshot(gfx::NativeWindow window,
return true;
}
} // namespace browser
} // namespace chrome
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// 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.
......@@ -11,10 +11,11 @@
#include "ui/base/x/x11_util.h"
#include "ui/gfx/rect.h"
namespace browser {
namespace {
static cairo_status_t SnapshotCallback(
void *closure, const unsigned char *data, unsigned int length) {
cairo_status_t SnapshotCallback(void* closure,
const unsigned char* data,
unsigned int length) {
std::vector<unsigned char>* png_representation =
static_cast<std::vector<unsigned char>*>(closure);
......@@ -24,6 +25,10 @@ static cairo_status_t SnapshotCallback(
return CAIRO_STATUS_SUCCESS;
}
} // namespace
namespace chrome {
bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds) {
......@@ -70,4 +75,4 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
return true;
}
} // namespace browser
} // namespace chrome
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// 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.
......@@ -11,11 +11,11 @@
#include "base/memory/scoped_nsobject.h"
#include "ui/gfx/rect.h"
namespace browser {
namespace chrome {
bool GrabWindowSnapshot(gfx::NativeWindow window,
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds) {
std::vector<unsigned char>* png_representation,
const gfx::Rect& snapshot_bounds) {
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
gfx::Rect screen_bounds = gfx::Rect(NSRectToCGRect([screen frame]));
gfx::Rect window_bounds = gfx::Rect(NSRectToCGRect([window frame]));
......@@ -58,4 +58,4 @@ bool GrabWindowSnapshot(gfx::NativeWindow window,
return true;
}
} // namespace browser
} // namespace chrome
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// 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.
......@@ -11,7 +11,7 @@
#include "testing/platform_test.h"
#include "ui/gfx/rect.h"
namespace browser {
namespace chrome {
namespace {
typedef PlatformTest GrabWindowSnapshotTest;
......@@ -30,8 +30,7 @@ TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) {
scoped_ptr<std::vector<unsigned char> > png_representation(
new std::vector<unsigned char>);
gfx::Rect bounds = gfx::Rect(0, 0, frame.size.width, frame.size.height);
EXPECT_TRUE(browser::GrabWindowSnapshot(window, png_representation.get(),
bounds));
EXPECT_TRUE(GrabWindowSnapshot(window, png_representation.get(), bounds));
// Copy png back into NSData object so we can make sure we grabbed a png.
scoped_nsobject<NSData> image_data(
......@@ -47,4 +46,4 @@ TEST_F(GrabWindowSnapshotTest, TestGrabWindowSnapshot) {
}
} // namespace
} // namespace browser
} // namespace chrome
......@@ -32,9 +32,9 @@ gfx::Rect GetWindowBounds(gfx::NativeWindow window_handle) {
content_rect.bottom - content_rect.top);
}
} // namespace
} // namespace
namespace browser {
namespace chrome {
bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
std::vector<unsigned char>* png_representation,
......@@ -97,4 +97,4 @@ bool GrabWindowSnapshot(gfx::NativeWindow window_handle,
return true;
}
} // namespace browser
} // namespace chrome
......@@ -124,9 +124,9 @@ bool SaveScreenSnapshotToDirectory(const FilePath& directory,
RECT& rect = monitor_info.rcMonitor;
std::vector<unsigned char> png_data;
if (browser::GrabWindowSnapshot(NULL, &png_data,
gfx::Rect(rect.right - rect.left,
rect.bottom - rect.top)) &&
if (chrome::GrabWindowSnapshot(NULL, &png_data,
gfx::Rect(rect.right - rect.left,
rect.bottom - rect.top)) &&
png_data.size() <= INT_MAX) {
int bytes = static_cast<int>(png_data.size());
int written = file_util::WriteFile(
......
......@@ -400,7 +400,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest {
tab_contents_bounds.height());
gfx::NativeWindow native_window = browser()->window()->GetNativeWindow();
if (!browser::GrabWindowSnapshot(native_window, &png, snapshot_bounds)) {
if (!chrome::GrabWindowSnapshot(native_window, &png, snapshot_bounds)) {
LOG(ERROR) << "browser::GrabWindowSnapShot() failed";
return false;
}
......
......@@ -230,7 +230,7 @@ class ThroughputTest : public BrowserPerfTest {
tab_contents_bounds.height());
gfx::NativeWindow native_window = browser()->window()->GetNativeWindow();
if (!browser::GrabWindowSnapshot(native_window, &png, snapshot_bounds)) {
if (!chrome::GrabWindowSnapshot(native_window, &png, snapshot_bounds)) {
LOG(ERROR) << "browser::GrabWindowSnapShot() failed";
return false;
}
......
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