Home | History | Annotate | Download | only in dbus
      1 //
      2 // Copyright (C) 2016 The Android Open Source Project
      3 //
      4 // Licensed under the Apache License, Version 2.0 (the "License");
      5 // you may not use this file except in compliance with the License.
      6 // You may obtain a copy of the License at
      7 //
      8 //      http://www.apache.org/licenses/LICENSE-2.0
      9 //
     10 // Unless required by applicable law or agreed to in writing, software
     11 // distributed under the License is distributed on an "AS IS" BASIS,
     12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 // See the License for the specific language governing permissions and
     14 // limitations under the License.
     15 //
     16 
     17 #ifndef SHILL_DBUS_DBUS_SERVICE_WATCHER_FACTORY_H_
     18 #define SHILL_DBUS_DBUS_SERVICE_WATCHER_FACTORY_H_
     19 
     20 #include <memory>
     21 #include <string>
     22 
     23 #include <base/callback.h>
     24 #include <base/lazy_instance.h>
     25 #include <dbus/bus.h>
     26 
     27 namespace shill {
     28 
     29 class ChromeosDBusServiceWatcher;
     30 
     31 class DBusServiceWatcherFactory {
     32  public:
     33   virtual ~DBusServiceWatcherFactory();
     34 
     35   // This is a singleton. Use DBusServiceWatcherFactory::GetInstance()->Foo().
     36   static DBusServiceWatcherFactory* GetInstance();
     37 
     38   virtual ChromeosDBusServiceWatcher* CreateDBusServiceWatcher(
     39       scoped_refptr<dbus::Bus> bus, const std::string& connection_name,
     40       const base::Closure& on_connection_vanish);
     41 
     42  protected:
     43   DBusServiceWatcherFactory();
     44 
     45  private:
     46   friend struct base::DefaultLazyInstanceTraits<DBusServiceWatcherFactory>;
     47 
     48   DISALLOW_COPY_AND_ASSIGN(DBusServiceWatcherFactory);
     49 };
     50 
     51 }  // namespace shill
     52 
     53 #endif  // SHILL_DBUS_DBUS_SERVICE_WATCHER_FACTORY_H_
     54