[mac] Dynamically update serviceability when the set of services changes
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Aug 2014 23:27:25 +0000 (23:27 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Aug 2014 23:27:25 +0000 (23:27 +0000)
commit76d5f5843e787afe9dca9a93ce6c25b3ffb5d62e
tree280e25e0040c430b04773afb96f2e8ccddf3fa9f
parentd7bc7e9e3d43b5ffc697714a504b5aa595ed3347
[mac] Dynamically update serviceability when the set of services changes
https://bugs.webkit.org/show_bug.cgi?id=135738
<rdar://problem/17533459>

Reviewed by Brady Eidson.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::createNewWebProcess):
Adopt the new universal refreshExistingServices.

(WebKit::WebContext::refreshExistingServices): Deleted.
* UIProcess/WebContext.h:
Remove WebContext::refreshExistingServices; there's no need for it.

* UIProcess/mac/ServicesController.h:
* UIProcess/mac/ServicesController.mm:
Fix the build with only public headers by including NSSharingService.h itself.
Place the NSSharingServicePicker (Details) category outside the #ifdef.
Forward-declare and possibly import NSExtension SPI.

(WebKit::ServicesController::ServicesController):
Register a callback to be notified whenever the set of services changes.
When this occurs, call refreshExistingServices. We let refreshExistingServices
coalesce updates because these notifications can come in small batches.

(WebKit::ServicesController::refreshExistingServices):
Dispatch changes in service availability to all processes in all contexts.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
Adjust the referenced rdar:// and call ServicesController::refreshExistingServices
instead of the now-removed WebContext:: variant. We can't remove this
yet because our services state can still be stale because NSServiceSharingPicker
can still sometimes lie about the current service state immediately after a change occurs;
once that is fixed, we should get rid of this as well as the refresh in Web Process creation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/mac/ServicesController.h
Source/WebKit2/UIProcess/mac/ServicesController.mm
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm