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; | |
59 | 58 |
60 WebIntentsRegistry(); | 59 WebIntentsRegistry(); |
61 virtual ~WebIntentsRegistry(); | 60 virtual ~WebIntentsRegistry(); |
62 | 61 |
63 private: | 62 private: |
64 struct IntentsQuery; | 63 struct IntentsQuery; |
65 | 64 |
66 // Maps web data requests to intents queries. | 65 // Maps web data requests to intents queries. |
67 // Allows OnWebDataServiceRequestDone to forward to appropriate consumer. | 66 // Allows OnWebDataServiceRequestDone to forward to appropriate consumer. |
68 typedef base::hash_map<WebDataService::Handle, IntentsQuery*> QueryMap; | 67 typedef base::hash_map<WebDataService::Handle, IntentsQuery*> QueryMap; |
69 | 68 |
70 // WebDataServiceConsumer implementation. | 69 // WebDataServiceConsumer implementation. |
71 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | 70 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, |
72 const WDTypedResult* result); | 71 const WDTypedResult* result); |
73 | 72 |
74 // Map for all in-flight web data requests/intent queries. | 73 // Map for all in-flight web data requests/intent queries. |
75 QueryMap queries_; | 74 QueryMap queries_; |
76 | 75 |
77 // Unique identifier for next intent query. | 76 // Unique identifier for next intent query. |
78 QueryID next_query_id_; | 77 QueryID next_query_id_; |
79 | 78 |
80 // Local reference to Web Data Service. | 79 // Local reference to Web Data Service. |
81 scoped_refptr<WebDataService> wds_; | 80 scoped_refptr<WebDataService> wds_; |
82 | 81 |
83 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); | 82 DISALLOW_COPY_AND_ASSIGN(WebIntentsRegistry); |
84 }; | 83 }; |
85 | 84 |
86 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ | 85 #endif // CHROME_BROWSER_INTENTS_WEB_INTENTS_REGISTRY_H_ |
OLD | NEW |