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.
2 /*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
9 #import "SkEventNotifier.h"
10 #include "SkEvent.h"
11 #define SkEventClass @"SkEvenClass"
12 @implementation SkEventNotifier
13 - (id)init {
14 self = [super init];
15 if (self) {
16 //Register as an observer for SkEventClass events and call
17 //receiveSkEvent: upon receiving the event
18 [[NSNotificationCenter defaultCenter] addObserver:self
19 selector:@selector(receiveSkEvent:)
20 name:SkEventClass
21 object:nil];
22 }
23 return self;
24 }
26 - (void)dealloc {
27 [[NSNotificationCenter defaultCenter] removeObserver:self];
28 [super dealloc];
29 }
31 -(BOOL) acceptsFirstResponder {
32 return YES;
33 }
35 //SkEvent Handers
36 - (void)receiveSkEvent:(NSNotification *)notification {
37 if(SkEvent::ProcessEvent())
38 SkEvent::SignalNonEmptyQueue();
39 }
41 + (void)postTimedSkEvent:(NSTimeInterval)timeInterval {
42 [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self
43 selector:@selector(timerFireMethod:)
44 userInfo:nil repeats:NO];
45 }
47 + (void)timerFireMethod:(NSTimer*)theTimer {
48 SkEvent::ServiceQueueTimer();
49 }
51 @end
52 ////////////////////////////////////////////////////////////////////////////////
53 void SkEvent::SignalNonEmptyQueue() {
54 //post a SkEventClass event to the default notification queue
55 NSNotification* notification = [NSNotification notificationWithName:SkEventClass object:nil];
56 [[NSNotificationQueue defaultQueue] enqueueNotification:notification
57 postingStyle:NSPostWhenIdle
58 coalesceMask:NSNotificationNoCoalescing
59 forModes:nil];
60 }
62 void SkEvent::SignalQueueTimer(SkMSec delay) {
63 if (delay) {
64 //Convert to seconds
65 NSTimeInterval ti = delay/(float)SK_MSec1;
66 [SkEventNotifier postTimedSkEvent:ti];
67 }
68 }