OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_INTENTS_WEB_INTENTS_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
6 #define CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 6 #define CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 QueryID GetIntentProviders(const string16& action, Consumer* consumer); | 48 QueryID GetIntentProviders(const string16& action, Consumer* consumer); |
49 | 49 |
50 // Requests all intent providers. |consumer| must not be NULL | 50 // Requests all intent providers. |consumer| must not be NULL |
51 QueryID GetAllIntentProviders(Consumer* consumer); | 51 QueryID GetAllIntentProviders(Consumer* consumer); |
52 | 52 |
53 protected: | 53 protected: |
54 // Make sure that only WebIntentsRegistryFactory can create an instance of | 54 // Make sure that only WebIntentsRegistryFactory can create an instance of |
55 // WebIntentsRegistry. | 55 // WebIntentsRegistry. |
56 friend class WebIntentsRegistryFactory; | 56 friend class WebIntentsRegistryFactory; |
57 friend class WebIntentsRegistryTest; | 57 friend class WebIntentsRegistryTest; |
| 58 friend class IntentsModelTest; |
58 | 59 |
59 WebIntentsRegistry(); | 60 WebIntentsRegistry(); |
60 virtual ~WebIntentsRegistry(); | 61 virtual ~WebIntentsRegistry(); |
61 | 62 |
62 private: | 63 private: |
63 struct IntentsQuery; | 64 struct IntentsQuery; |
64 | 65 |
65 // Maps web data requests to intents queries. | 66 // Maps web data requests to intents queries. |
66 // Allows OnWebDataServiceRequestDone to forward to appropriate consumer. | 67 // Allows OnWebDataServiceRequestDone to forward to appropriate consumer. |
67 typedef base::hash_map<WebDataService::Handle, IntentsQuery*> QueryMap; | 68 typedef base::hash_map<WebDataService::Handle, IntentsQuery*> QueryMap; |
68 | 69 |
69 // WebDataServiceConsumer implementation. | 70 // WebDataServiceConsumer implementation. |
70 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 71 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
71 const WDTypedResult* result); | 72 const WDTypedResult* result); |
72 | 73 |
73 // Map for all in-flight web data requests/intent queries. | 74 // Map for all in-flight web data requests/intent queries. |
74 QueryMap queries_; | 75 QueryMap queries_; |
75 | 76 |
76 // Unique identifier for next intent query. | 77 // Unique identifier for next intent query. |
77 QueryID next_query_id_; | 78 QueryID next_query_id_; |
78 | 79 |
79 // Local reference to Web Data Service. | 80 // Local reference to Web Data Service. |
80 scoped_refptr<WebDataService> wds_; | 81 scoped_refptr<WebDataService> wds_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 83 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
83 }; | 84 }; |
84 | 85 |
85 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 86 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
OLD | NEW |