widget/gtk/nsClipboard.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim:expandtab:shiftwidth=4:tabstop=4:
     3  */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this
     6  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 #ifndef __nsClipboard_h_
     9 #define __nsClipboard_h_
    11 #include "nsIClipboard.h"
    12 #include "nsClipboardPrivacyHandler.h"
    13 #include "nsAutoPtr.h"
    14 #include <gtk/gtk.h>
    16 class nsClipboard : public nsIClipboard,
    17                     public nsIObserver
    18 {
    19 public:
    20     nsClipboard();
    21     virtual ~nsClipboard();
    23     NS_DECL_ISUPPORTS
    25     NS_DECL_NSICLIPBOARD
    26     NS_DECL_NSIOBSERVER
    28     // Make sure we are initialized, called from the factory
    29     // constructor
    30     nsresult  Init              (void);
    32     // Someone requested the selection
    33     void   SelectionGetEvent    (GtkClipboard     *aGtkClipboard,
    34                                  GtkSelectionData *aSelectionData);
    35     void   SelectionClearEvent  (GtkClipboard     *aGtkClipboard);
    37 private:
    38     // Utility methods
    39     static GdkAtom               GetSelectionAtom (int32_t aWhichClipboard);
    40     static GtkSelectionData     *GetTargets       (GdkAtom aWhichClipboard);
    42     // Save global clipboard content to gtk
    43     nsresult                     Store            (void);
    45     // Get our hands on the correct transferable, given a specific
    46     // clipboard
    47     nsITransferable             *GetTransferable  (int32_t aWhichClipboard);
    49     // Hang on to our owners and transferables so we can transfer data
    50     // when asked.
    51     nsCOMPtr<nsIClipboardOwner>  mSelectionOwner;
    52     nsCOMPtr<nsIClipboardOwner>  mGlobalOwner;
    53     nsCOMPtr<nsITransferable>    mSelectionTransferable;
    54     nsCOMPtr<nsITransferable>    mGlobalTransferable;
    55     nsRefPtr<nsClipboardPrivacyHandler> mPrivacyHandler;
    57 };
    59 #endif /* __nsClipboard_h_ */

mercurial