widget/gonk/nsIdleServiceGonk.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/gonk/nsIdleServiceGonk.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* vim:expandtab:shiftwidth=4:tabstop=4: */
     1.6 +/* Copyright 2012 Mozilla Foundation and Mozilla contributors
     1.7 + *
     1.8 + * Licensed under the Apache License, Version 2.0 (the "License");
     1.9 + * you may not use this file except in compliance with the License.
    1.10 + * You may obtain a copy of the License at
    1.11 + *
    1.12 + *     http://www.apache.org/licenses/LICENSE-2.0
    1.13 + *
    1.14 + * Unless required by applicable law or agreed to in writing, software
    1.15 + * distributed under the License is distributed on an "AS IS" BASIS,
    1.16 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1.17 + * See the License for the specific language governing permissions and
    1.18 + * limitations under the License.
    1.19 + */
    1.20 +
    1.21 +#ifndef nsIdleServiceGonk_h__
    1.22 +#define nsIdleServiceGonk_h__
    1.23 +
    1.24 +#include "nsIdleService.h"
    1.25 +
    1.26 +class nsIdleServiceGonk : public nsIdleService
    1.27 +{
    1.28 +public:
    1.29 +    NS_DECL_ISUPPORTS_INHERITED
    1.30 +
    1.31 +    bool PollIdleTime(uint32_t* aIdleTime);
    1.32 +
    1.33 +    static already_AddRefed<nsIdleServiceGonk> GetInstance()
    1.34 +    {
    1.35 +        nsRefPtr<nsIdleServiceGonk> idleService =
    1.36 +            nsIdleService::GetInstance().downcast<nsIdleServiceGonk>();
    1.37 +        if (!idleService) {
    1.38 +            idleService = new nsIdleServiceGonk();
    1.39 +        }
    1.40 +
    1.41 +        return idleService.forget();
    1.42 +    }
    1.43 +
    1.44 +protected:
    1.45 +    nsIdleServiceGonk() { }
    1.46 +    virtual ~nsIdleServiceGonk() { }
    1.47 +    bool UsePollMode();
    1.48 +};
    1.49 +
    1.50 +#endif // nsIdleServiceGonk_h__

mercurial