Reduce cookie tracking [2/4]

the HasCookies call was implemented by counting all cookies and then
returning true or false. replace HasCookies functionality by a wrapper
around CountCookies, and allow CountCookies to be called from java.

Change-Id: I863a7f683c617bd5026fbe4909a0e5cd52f0a8e3