Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/browser/intents/cws_intents_registry.h

Issue 10821068: Revert 148720 - [Web Intents] Localization of intent titles for CWS suggestions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/intents/cws_intents_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_INTENTS_CWS_INTENTS_REGISTRY_H_ 5 #ifndef CHROME_BROWSER_INTENTS_CWS_INTENTS_REGISTRY_H_
6 #define CHROME_BROWSER_INTENTS_CWS_INTENTS_REGISTRY_H_ 6 #define CHROME_BROWSER_INTENTS_CWS_INTENTS_REGISTRY_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/profiles/profile_keyed_service.h" 12 #include "chrome/browser/profiles/profile_keyed_service.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "net/url_request/url_fetcher_delegate.h" 14 #include "net/url_request/url_fetcher_delegate.h"
15 15
16 namespace net { 16 namespace net {
17 class URLRequestContextGetter; 17 class URLRequestContextGetter;
18 } 18 }
19 19
20 class CWSIntentsRegistryForTest;
21
22 // Handles storing and retrieving of web intents in the web database. 20 // Handles storing and retrieving of web intents in the web database.
23 // The registry provides filtering logic to retrieve specific types of intents. 21 // The registry provides filtering logic to retrieve specific types of intents.
24 class CWSIntentsRegistry : public ProfileKeyedService, 22 class CWSIntentsRegistry : public ProfileKeyedService,
25 public net::URLFetcherDelegate { 23 public net::URLFetcherDelegate {
26 public: 24 public:
27 // Data returned from CWS for a single service. 25 // Data returned from CWS for a single service.
28 struct IntentExtensionInfo { 26 struct IntentExtensionInfo {
29 IntentExtensionInfo(); 27 IntentExtensionInfo();
30 ~IntentExtensionInfo(); 28 ~IntentExtensionInfo();
31 29
(...skipping 19 matching lines...) Expand all
51 const string16& mimetype, 49 const string16& mimetype,
52 const ResultsCallback& callback); 50 const ResultsCallback& callback);
53 51
54 // Build a REST query URL to retrieve intent info from CWS. 52 // Build a REST query URL to retrieve intent info from CWS.
55 static GURL BuildQueryURL(const string16& action, const string16& type); 53 static GURL BuildQueryURL(const string16& action, const string16& type);
56 54
57 private: 55 private:
58 // Make sure that only CWSIntentsRegistryFactory can create an instance of 56 // Make sure that only CWSIntentsRegistryFactory can create an instance of
59 // CWSIntentsRegistry. 57 // CWSIntentsRegistry.
60 friend class CWSIntentsRegistryFactory; 58 friend class CWSIntentsRegistryFactory;
61 friend class ::CWSIntentsRegistryForTest; 59 FRIEND_TEST_ALL_PREFIXES(CWSIntentsRegistryTest, ValidQuery);
60 FRIEND_TEST_ALL_PREFIXES(CWSIntentsRegistryTest, InvalidQuery);
62 61
63 struct IntentsQuery; 62 struct IntentsQuery;
64 63
65 // This is an opaque version of URLFetcher*, so we can use it as a hash key. 64 // This is an opaque version of URLFetcher*, so we can use it as a hash key.
66 typedef intptr_t URLFetcherHandle; 65 typedef intptr_t URLFetcherHandle;
67 66
68 // Maps URL fetchers to queries. IntentsQuery objects are owned by the map. 67 // Maps URL fetchers to queries. IntentsQuery objects are owned by the map.
69 typedef base::hash_map<URLFetcherHandle, IntentsQuery*> QueryMap; 68 typedef base::hash_map<URLFetcherHandle, IntentsQuery*> QueryMap;
70 69
71 // |context| is a profile-dependent URL request context. Must not be NULL. 70 // |context| is a profile-dependent URL request context. Must not be NULL.
72 explicit CWSIntentsRegistry(net::URLRequestContextGetter* context); 71 explicit CWSIntentsRegistry(net::URLRequestContextGetter* context);
73 virtual ~CWSIntentsRegistry(); 72 virtual ~CWSIntentsRegistry();
74 73
75 // net::URLFetcherDelegate implementation. 74 // net::URLFetcherDelegate implementation.
76 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 75 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
77 76
78 // Map for all in-flight web data requests/intent queries. 77 // Map for all in-flight web data requests/intent queries.
79 QueryMap queries_; 78 QueryMap queries_;
80 79
81 // Request context for any CWS requests. 80 // Request context for any CWS requests.
82 scoped_refptr<net::URLRequestContextGetter> request_context_; 81 scoped_refptr<net::URLRequestContextGetter> request_context_;
83 82
84 DISALLOW_COPY_AND_ASSIGN(CWSIntentsRegistry); 83 DISALLOW_COPY_AND_ASSIGN(CWSIntentsRegistry);
85 }; 84 };
86 85
87 #endif // CHROME_BROWSER_INTENTS_CWS_INTENTS_REGISTRY_H_ 86 #endif // CHROME_BROWSER_INTENTS_CWS_INTENTS_REGISTRY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/intents/cws_intents_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698