Sat, 03 Jan 2015 20:18:00 +0100
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 | /* |
michael@0 | 3 | * Copyright 2011 Google Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | #include "SkBorderView.h" |
michael@0 | 9 | #include "SkAnimator.h" |
michael@0 | 10 | #include "SkWidgetViews.h" |
michael@0 | 11 | #include "SkSystemEventTypes.h" |
michael@0 | 12 | #include "SkTime.h" |
michael@0 | 13 | #include "SkStackViewLayout.h" |
michael@0 | 14 | |
michael@0 | 15 | SkBorderView::SkBorderView() : fLeft(SkIntToScalar(0)), |
michael@0 | 16 | fRight(SkIntToScalar(0)), |
michael@0 | 17 | fTop(SkIntToScalar(0)), |
michael@0 | 18 | fBottom(SkIntToScalar(0)) |
michael@0 | 19 | { |
michael@0 | 20 | fAnim.setHostEventSink(this); |
michael@0 | 21 | init_skin_anim(kBorder_SkinEnum, &fAnim); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | SkBorderView::~SkBorderView() |
michael@0 | 25 | { |
michael@0 | 26 | |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | void SkBorderView::setSkin(const char skin[]) |
michael@0 | 30 | { |
michael@0 | 31 | init_skin_anim(skin, &fAnim); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | /* virtual */ void SkBorderView::onInflate(const SkDOM& dom, const SkDOM::Node* node) |
michael@0 | 35 | { |
michael@0 | 36 | this->INHERITED::onInflate(dom, node); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | /*virtual*/ void SkBorderView::onSizeChange() |
michael@0 | 40 | { |
michael@0 | 41 | this->INHERITED::onSizeChange(); |
michael@0 | 42 | SkEvent evt("user"); |
michael@0 | 43 | evt.setString("id", "setDim"); |
michael@0 | 44 | evt.setScalar("dimX", this->width()); |
michael@0 | 45 | evt.setScalar("dimY", this->height()); |
michael@0 | 46 | fAnim.doUserEvent(evt); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | /*virtual*/ void SkBorderView::onDraw(SkCanvas* canvas) |
michael@0 | 50 | { |
michael@0 | 51 | SkPaint paint; |
michael@0 | 52 | SkAnimator::DifferenceType diff = fAnim.draw(canvas, &paint, SkTime::GetMSecs()); |
michael@0 | 53 | |
michael@0 | 54 | if (diff == SkAnimator::kDifferent) |
michael@0 | 55 | this->inval(NULL); |
michael@0 | 56 | else if (diff == SkAnimator::kPartiallyDifferent) |
michael@0 | 57 | { |
michael@0 | 58 | SkRect bounds; |
michael@0 | 59 | fAnim.getInvalBounds(&bounds); |
michael@0 | 60 | this->inval(&bounds); |
michael@0 | 61 | } |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | /*virtual*/ bool SkBorderView::onEvent(const SkEvent& evt) |
michael@0 | 65 | { |
michael@0 | 66 | if (evt.isType(SK_EventType_Inval)) |
michael@0 | 67 | { |
michael@0 | 68 | this->inval(NULL); |
michael@0 | 69 | return true; |
michael@0 | 70 | } |
michael@0 | 71 | if (evt.isType("recommendDim")) |
michael@0 | 72 | { |
michael@0 | 73 | evt.findScalar("leftMargin", &fLeft); |
michael@0 | 74 | evt.findScalar("rightMargin", &fRight); |
michael@0 | 75 | evt.findScalar("topMargin", &fTop); |
michael@0 | 76 | evt.findScalar("bottomMargin", &fBottom); |
michael@0 | 77 | |
michael@0 | 78 | //setup_views.cpp uses SkView::Layout instead of SkStackViewLayout |
michael@0 | 79 | //but that gives me an error |
michael@0 | 80 | SkStackViewLayout* layout; |
michael@0 | 81 | fMargin.set(fLeft, fTop, fRight, fBottom); |
michael@0 | 82 | if (this->getLayout()) |
michael@0 | 83 | { |
michael@0 | 84 | layout = (SkStackViewLayout*)this->getLayout(); |
michael@0 | 85 | layout->setMargin(fMargin); |
michael@0 | 86 | } |
michael@0 | 87 | else |
michael@0 | 88 | { |
michael@0 | 89 | layout = new SkStackViewLayout; |
michael@0 | 90 | layout->setMargin(fMargin); |
michael@0 | 91 | this->setLayout(layout)->unref(); |
michael@0 | 92 | } |
michael@0 | 93 | this->invokeLayout(); |
michael@0 | 94 | } |
michael@0 | 95 | return this->INHERITED::onEvent(evt); |
michael@0 | 96 | } |