| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/extensions/api/dial/dial_device_data.h" | 10 #include "chrome/browser/extensions/api/dial/dial_device_data.h" |
| 11 #include "chrome/browser/extensions/api/dial/dial_registry.h" | 11 #include "chrome/browser/extensions/api/dial/dial_registry.h" |
| 12 #include "components/keyed_service/core/refcounted_keyed_service.h" | 12 #include "components/keyed_service/core/refcounted_keyed_service.h" |
| 13 #include "extensions/browser/api/async_api_function.h" | 13 #include "extensions/browser/api/async_api_function.h" |
| 14 #include "extensions/browser/event_router.h" | 14 #include "extensions/browser/event_router.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 class DialRegistry; | 18 class DialRegistry; |
| 19 | 19 |
| 20 // Dial API which is a ref-counted KeyedService that manages | 20 // Dial API which is a ref-counted KeyedService that manages |
| 21 // the DIAL registry. It takes care of creating the registry on the IO thread | 21 // the DIAL registry. It takes care of creating the registry on the IO thread |
| 22 // and is an observer of the registry. It makes sure devices events are sent out | 22 // and is an observer of the registry. It makes sure devices events are sent out |
| 23 // to extension listeners on the right thread. | 23 // to extension listeners on the right thread. |
| 24 // |
| 25 // TODO(mfoltz): This should probably inherit from BrowserContextKeyedAPI |
| 26 // instead; ShutdownOnUIThread below is a no-op, which is the whole point of |
| 27 // RefcountedKeyedService. |
| 24 class DialAPI : public RefcountedKeyedService, | 28 class DialAPI : public RefcountedKeyedService, |
| 25 public EventRouter::Observer, | 29 public EventRouter::Observer, |
| 26 public DialRegistry::Observer { | 30 public DialRegistry::Observer { |
| 27 public: | 31 public: |
| 28 explicit DialAPI(Profile* profile); | 32 explicit DialAPI(Profile* profile); |
| 29 | 33 |
| 30 // The DialRegistry for the API. This must always be used only from the IO | 34 // The DialRegistry for the API. This must always be used only from the IO |
| 31 // thread. | 35 // thread. |
| 32 DialRegistry* dial_registry(); | 36 DialRegistry* dial_registry(); |
| 33 | 37 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 bool result_; | 97 bool result_; |
| 94 | 98 |
| 95 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); | 99 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); |
| 96 }; | 100 }; |
| 97 | 101 |
| 98 } // namespace api | 102 } // namespace api |
| 99 | 103 |
| 100 } // namespace extensions | 104 } // namespace extensions |
| 101 | 105 |
| 102 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ | 106 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
| OLD | NEW |