1e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)// found in the LICENSE file.
4e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
5e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#ifndef WebServiceWorkerRegistrationProxy_h
6e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#define WebServiceWorkerRegistrationProxy_h
7e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
87242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#if INSIDE_BLINK
97242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#include "platform/heap/Handle.h"
107242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#endif
11e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#include "public/platform/WebCommon.h"
12e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
13e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)namespace blink {
14e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
15e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class ServiceWorkerRegistration;
16e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class WebServiceWorker;
17e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
18e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)// A proxy interface, passed via WebServiceWorkerRegistration.setProxy() from
19e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)// blink to the embedder, to talk to the ServiceWorkerRegistration object from
20e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)// embedder.
21e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class WebServiceWorkerRegistrationProxy {
22e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)public:
23e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    WebServiceWorkerRegistrationProxy() : m_private(0) { }
24e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual ~WebServiceWorkerRegistrationProxy() { }
25e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
26e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    // Notifies that the registration entered the installation process.
27e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    // The installing worker should be accessible via
28e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    // WebServiceWorkerRegistration.installing.
29e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void dispatchUpdateFoundEvent() = 0;
30e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
31e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void setInstalling(WebServiceWorker*) = 0;
32e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void setWaiting(WebServiceWorker*) = 0;
33e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    virtual void setActive(WebServiceWorker*) = 0;
34e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
35e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#if INSIDE_BLINK
36e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    BLINK_PLATFORM_EXPORT WebServiceWorkerRegistrationProxy(ServiceWorkerRegistration*);
37e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    BLINK_PLATFORM_EXPORT operator ServiceWorkerRegistration*() const;
38e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#endif
39e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
40e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)protected:
417242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#if INSIDE_BLINK
427242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // This is a back pointer to |this| object.
437242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    // The ServiceWorkerRegistration inherits from this WebServiceWorkerRegistrationProxy.
447242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    GC_PLUGIN_IGNORE("crbug.com/410257")
457242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#endif
46e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)    ServiceWorkerRegistration* m_private;
47e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)};
48e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
49e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)} // namespace blink
50e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)
51e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)#endif // WebServiceWorkerRegistrationProxy_h
52