gfx/ipc/SharedDIBWin.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef gfx_SharedDIBWin_h__
     7 #define gfx_SharedDIBWin_h__
     9 #include <windows.h>
    11 #include "SharedDIB.h"
    13 namespace mozilla {
    14 namespace gfx {
    16 class SharedDIBWin : public SharedDIB
    17 {
    18 public:
    19   SharedDIBWin();
    20   ~SharedDIBWin();
    22   // Allocate a new win32 dib section compatible with an hdc. The dib will
    23   // be selected into the hdc on return.
    24   nsresult Create(HDC aHdc, uint32_t aWidth, uint32_t aHeight,
    25                   bool aTransparent);
    27   // Wrap a dib section around an existing shared memory object. aHandle should
    28   // point to a section large enough for the dib's memory, otherwise this call
    29   // will fail.
    30   nsresult Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight,
    31                   bool aTransparent);
    33   // Destroy or release resources associated with this dib.
    34   nsresult Close();
    36   // Return the HDC of the shared dib.
    37   HDC GetHDC() { return mSharedHdc; }
    39   // Return the bitmap bits.
    40   void* GetBits() { return mBitmapBits; }
    42 private:
    43   HDC                 mSharedHdc;
    44   HBITMAP             mSharedBmp;
    45   HGDIOBJ             mOldObj;
    46   void*               mBitmapBits;
    48   uint32_t SetupBitmapHeader(uint32_t aWidth, uint32_t aHeight,
    49                              bool aTransparent, BITMAPV4HEADER *aHeader);
    50   nsresult SetupSurface(HDC aHdc, BITMAPV4HEADER *aHdr);
    51 };
    53 } // gfx
    54 } // mozilla
    56 #endif

mercurial