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 <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/extensions/api/dial/dial_device_data.h" | 11 #include "chrome/browser/extensions/api/dial/dial_device_data.h" |
11 #include "chrome/browser/extensions/api/dial/dial_registry.h" | 12 #include "chrome/browser/extensions/api/dial/dial_registry.h" |
12 #include "components/keyed_service/core/refcounted_keyed_service.h" | 13 #include "components/keyed_service/core/refcounted_keyed_service.h" |
13 #include "extensions/browser/api/async_api_function.h" | 14 #include "extensions/browser/api/async_api_function.h" |
14 #include "extensions/browser/event_router.h" | 15 #include "extensions/browser/event_router.h" |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 class DialRegistry; | 19 class DialRegistry; |
19 | 20 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void OnDialError(DialRegistry::DialErrorCode type) override; | 56 void OnDialError(DialRegistry::DialErrorCode type) override; |
56 | 57 |
57 // Methods to notify the DialRegistry on the correct thread of new/removed | 58 // Methods to notify the DialRegistry on the correct thread of new/removed |
58 // listeners. | 59 // listeners. |
59 void NotifyListenerAddedOnIOThread(); | 60 void NotifyListenerAddedOnIOThread(); |
60 void NotifyListenerRemovedOnIOThread(); | 61 void NotifyListenerRemovedOnIOThread(); |
61 | 62 |
62 Profile* profile_; | 63 Profile* profile_; |
63 | 64 |
64 // Created lazily on first access on the IO thread. | 65 // Created lazily on first access on the IO thread. |
65 scoped_ptr<DialRegistry> dial_registry_; | 66 std::unique_ptr<DialRegistry> dial_registry_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(DialAPI); | 68 DISALLOW_COPY_AND_ASSIGN(DialAPI); |
68 }; | 69 }; |
69 | 70 |
70 namespace api { | 71 namespace api { |
71 | 72 |
72 // DiscoverNow function. This function needs a round-trip from the IO thread | 73 // DiscoverNow function. This function needs a round-trip from the IO thread |
73 // because it needs to grab a pointer to the DIAL API in order to get a | 74 // because it needs to grab a pointer to the DIAL API in order to get a |
74 // reference to the DialRegistry while on the IO thread. Then, the result | 75 // reference to the DialRegistry while on the IO thread. Then, the result |
75 // must be returned on the UI thread. | 76 // must be returned on the UI thread. |
(...skipping 21 matching lines...) Expand all Loading... |
97 bool result_; | 98 bool result_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); | 100 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); |
100 }; | 101 }; |
101 | 102 |
102 } // namespace api | 103 } // namespace api |
103 | 104 |
104 } // namespace extensions | 105 } // namespace extensions |
105 | 106 |
106 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ | 107 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
OLD | NEW |