gfx/skia/trunk/include/views/SkWindow.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.

michael@0 1 /*
michael@0 2 * Copyright 2006 The Android Open Source Project
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef SkWindow_DEFINED
michael@0 9 #define SkWindow_DEFINED
michael@0 10
michael@0 11 #include "SkView.h"
michael@0 12 #include "SkBitmap.h"
michael@0 13 #include "SkMatrix.h"
michael@0 14 #include "SkRegion.h"
michael@0 15 #include "SkEvent.h"
michael@0 16 #include "SkKey.h"
michael@0 17 #include "SkTDArray.h"
michael@0 18
michael@0 19 #ifdef SK_BUILD_FOR_WINCEx
michael@0 20 #define SHOW_FPS
michael@0 21 #endif
michael@0 22 //#define USE_GX_SCREEN
michael@0 23
michael@0 24 class SkCanvas;
michael@0 25
michael@0 26 class SkOSMenu;
michael@0 27
michael@0 28 class SkWindow : public SkView {
michael@0 29 public:
michael@0 30 SkWindow();
michael@0 31 virtual ~SkWindow();
michael@0 32
michael@0 33 const SkBitmap& getBitmap() const { return fBitmap; }
michael@0 34
michael@0 35 void setColorType(SkColorType);
michael@0 36 void resize(int width, int height, SkColorType = kUnknown_SkColorType);
michael@0 37
michael@0 38 bool isDirty() const { return !fDirtyRgn.isEmpty(); }
michael@0 39 bool update(SkIRect* updateArea);
michael@0 40 // does not call through to onHandleInval(), but does force the fDirtyRgn
michael@0 41 // to be wide open. Call before update() to ensure we redraw everything.
michael@0 42 void forceInvalAll();
michael@0 43 // return the bounds of the dirty/inval rgn, or [0,0,0,0] if none
michael@0 44 const SkIRect& getDirtyBounds() const { return fDirtyRgn.getBounds(); }
michael@0 45
michael@0 46 bool handleClick(int x, int y, Click::State, void* owner, unsigned modi = 0);
michael@0 47 bool handleChar(SkUnichar);
michael@0 48 bool handleKey(SkKey);
michael@0 49 bool handleKeyUp(SkKey);
michael@0 50
michael@0 51 void addMenu(SkOSMenu*);
michael@0 52 const SkTDArray<SkOSMenu*>* getMenus() { return &fMenus; }
michael@0 53
michael@0 54 const char* getTitle() const { return fTitle.c_str(); }
michael@0 55 void setTitle(const char title[]);
michael@0 56
michael@0 57 const SkMatrix& getMatrix() const { return fMatrix; }
michael@0 58 void setMatrix(const SkMatrix&);
michael@0 59 void preConcat(const SkMatrix&);
michael@0 60 void postConcat(const SkMatrix&);
michael@0 61
michael@0 62 virtual SkCanvas* createCanvas();
michael@0 63
michael@0 64 virtual void onPDFSaved(const char title[], const char desc[],
michael@0 65 const char path[]) {}
michael@0 66 protected:
michael@0 67 virtual bool onEvent(const SkEvent&);
michael@0 68 virtual bool onDispatchClick(int x, int y, Click::State, void* owner, unsigned modi);
michael@0 69 // called if part of our bitmap is invalidated
michael@0 70 virtual void onHandleInval(const SkIRect&);
michael@0 71 virtual bool onHandleChar(SkUnichar);
michael@0 72 virtual bool onHandleKey(SkKey);
michael@0 73 virtual bool onHandleKeyUp(SkKey);
michael@0 74 virtual void onAddMenu(const SkOSMenu*) {};
michael@0 75 virtual void onUpdateMenu(const SkOSMenu*) {};
michael@0 76 virtual void onSetTitle(const char title[]) {}
michael@0 77
michael@0 78 // overrides from SkView
michael@0 79 virtual bool handleInval(const SkRect*);
michael@0 80 virtual bool onGetFocusView(SkView** focus) const;
michael@0 81 virtual bool onSetFocusView(SkView* focus);
michael@0 82
michael@0 83 private:
michael@0 84 SkColorType fColorType;
michael@0 85 SkBitmap fBitmap;
michael@0 86 SkRegion fDirtyRgn;
michael@0 87
michael@0 88 SkTDArray<Click*> fClicks; // to track clicks
michael@0 89
michael@0 90 SkTDArray<SkOSMenu*> fMenus;
michael@0 91
michael@0 92 SkView* fFocusView;
michael@0 93 bool fWaitingOnInval;
michael@0 94
michael@0 95 SkString fTitle;
michael@0 96 SkMatrix fMatrix;
michael@0 97
michael@0 98 typedef SkView INHERITED;
michael@0 99 };
michael@0 100
michael@0 101 ////////////////////////////////////////////////////////////////////////////////
michael@0 102
michael@0 103 #if defined(SK_BUILD_FOR_NACL)
michael@0 104 #include "SkOSWindow_NaCl.h"
michael@0 105 #elif defined(SK_BUILD_FOR_MAC)
michael@0 106 #include "SkOSWindow_Mac.h"
michael@0 107 #elif defined(SK_BUILD_FOR_WIN)
michael@0 108 #include "SkOSWindow_Win.h"
michael@0 109 #elif defined(SK_BUILD_FOR_ANDROID)
michael@0 110 #include "SkOSWindow_Android.h"
michael@0 111 #elif defined(SK_BUILD_FOR_UNIX)
michael@0 112 #include "SkOSWindow_Unix.h"
michael@0 113 #elif defined(SK_BUILD_FOR_SDL)
michael@0 114 #include "SkOSWindow_SDL.h"
michael@0 115 #elif defined(SK_BUILD_FOR_IOS)
michael@0 116 #include "SkOSWindow_iOS.h"
michael@0 117 #endif
michael@0 118
michael@0 119 #endif

mercurial