diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 17:26:49 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-28 17:26:49 +0000 |
commit | d65adb173f09a837c96f96fc24a258f439e46e58 (patch) | |
tree | 43605ab367e97389930c518c4e94bd3da5f20080 /app | |
parent | 7cea56d943924d0c2196bdf4049f592b6182992c (diff) | |
download | chromium_src-d65adb173f09a837c96f96fc24a258f439e46e58.zip chromium_src-d65adb173f09a837c96f96fc24a258f439e46e58.tar.gz chromium_src-d65adb173f09a837c96f96fc24a258f439e46e58.tar.bz2 |
This adds in the ability for Chrome to generate windows with snapshots
of all currently open tabs in all browsers.
This is needed for overview mode on ChromeOS.
BUG=http://code.google.com/p/chromium-os/issues/detail?id=1170
TEST=Ran Chrome under ChromeOS with updated window manager.
Review URL: http://codereview.chromium.org/661237
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/surface/transport_dib.h | 21 | ||||
-rw-r--r-- | app/x11_util.cc | 38 | ||||
-rw-r--r-- | app/x11_util.h | 6 |
3 files changed, 63 insertions, 2 deletions
diff --git a/app/surface/transport_dib.h b/app/surface/transport_dib.h index 7a60f08..44fb6a9 100644 --- a/app/surface/transport_dib.h +++ b/app/surface/transport_dib.h @@ -73,6 +73,13 @@ class TransportDIB { // Returns a default, invalid handle, that is meant to indicate a missing // Transport DIB. static Handle DefaultHandleValue() { return NULL; } + + // Returns a value that is ONLY USEFUL FOR TESTS WHERE IT WON'T BE + // ACTUALLY USED AS A REAL HANDLE. + static Handle GetFakeHandleForTest() { + static int fake_handle = 10; + return reinterpret_cast<Handle>(fake_handle++); + } #elif defined(OS_MACOSX) typedef base::SharedMemoryHandle Handle; // On Mac, the inode number of the backing file is used as an id. @@ -81,6 +88,13 @@ class TransportDIB { // Returns a default, invalid handle, that is meant to indicate a missing // Transport DIB. static Handle DefaultHandleValue() { return Handle(); } + + // Returns a value that is ONLY USEFUL FOR TESTS WHERE IT WON'T BE + // ACTUALLY USED AS A REAL HANDLE. + static Handle GetFakeHandleForTest() { + static int fake_handle = 10; + return Handle(fake_handle++, false); + } #elif defined(USE_X11) typedef int Handle; // These two ints are SysV IPC shared memory keys typedef int Id; @@ -88,6 +102,13 @@ class TransportDIB { // Returns a default, invalid handle, that is meant to indicate a missing // Transport DIB. static Handle DefaultHandleValue() { return -1; } + + // Returns a value that is ONLY USEFUL FOR TESTS WHERE IT WON'T BE + // ACTUALLY USED AS A REAL HANDLE. + static Handle GetFakeHandleForTest() { + static int fake_handle = 10; + return fake_handle++; + } #endif // Create a new TransportDIB, returning NULL on failure. diff --git a/app/x11_util.cc b/app/x11_util.cc index 38799ad..b6b63b3 100644 --- a/app/x11_util.cc +++ b/app/x11_util.cc @@ -229,6 +229,44 @@ bool GetIntProperty(XID window, const std::string& property_name, int* value) { return true; } +bool GetIntArrayProperty(XID window, + const std::string& property_name, + std::vector<int>* value) { + Atom property_atom = gdk_x11_get_xatom_by_name_for_display( + gdk_display_get_default(), property_name.c_str()); + + Atom type = None; + int format = 0; // size in bits of each item in 'property' + long unsigned int num_items = 0, remaining_bytes = 0; + unsigned char* properties = NULL; + + int result = XGetWindowProperty(GetXDisplay(), + window, + property_atom, + 0, // offset into property data to read + (~0L), // max length to get (all of them) + False, // deleted + AnyPropertyType, + &type, + &format, + &num_items, + &remaining_bytes, + &properties); + if (result != Success) + return false; + + if (format != 32) { + XFree(properties); + return false; + } + + int* int_properties = reinterpret_cast<int*>(properties); + value->clear(); + value->insert(value->begin(), int_properties, int_properties + num_items); + XFree(properties); + return true; +} + bool GetStringProperty( XID window, const std::string& property_name, std::string* value) { Atom property_atom = gdk_x11_get_xatom_by_name_for_display( diff --git a/app/x11_util.h b/app/x11_util.h index 1c8685f1..5c202f3 100644 --- a/app/x11_util.h +++ b/app/x11_util.h @@ -78,9 +78,11 @@ int BitsPerPixelForPixmapDepth(Display* display, int depth); bool IsWindowVisible(XID window); // Returns the bounds of |window|. bool GetWindowRect(XID window, gfx::Rect* rect); -// Get the value of an int or string property. On success, true is returned and -// the value is stored in |value|. +// Get the value of an int, int array, or string property. On +// success, true is returned and the value is stored in |value|. bool GetIntProperty(XID window, const std::string& property_name, int* value); +bool GetIntArrayProperty(XID window, const std::string& property_name, + std::vector<int>* value); bool GetStringProperty( XID window, const std::string& property_name, std::string* value); |