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

Side by Side Diff: chrome/browser/intents/web_intents_registry.cc

Issue 8417043: Add webkit_glue namespace. Improve some variable and test names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
OLDNEW
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 #include "chrome/browser/intents/web_intents_registry.h" 5 #include "chrome/browser/intents/web_intents_registry.h"
6 #include "chrome/browser/webdata/web_data_service.h" 6 #include "chrome/browser/webdata/web_data_service.h"
7 7
8 using webkit_glue::WebIntentServiceData;
9
8 // Internal object representing all data associated with a single query. 10 // Internal object representing all data associated with a single query.
9 struct WebIntentsRegistry::IntentsQuery { 11 struct WebIntentsRegistry::IntentsQuery {
10 // Unique query identifier. 12 // Unique query identifier.
11 QueryID query_id_; 13 QueryID query_id_;
12 14
13 // Underlying data query. 15 // Underlying data query.
14 WebDataService::Handle pending_query_; 16 WebDataService::Handle pending_query_;
15 17
16 // The consumer for this particular query. 18 // The consumer for this particular query.
17 Consumer* consumer_; 19 Consumer* consumer_;
(...skipping 30 matching lines...) Expand all
48 DCHECK(result->GetType() == WEB_INTENTS_RESULT); 50 DCHECK(result->GetType() == WEB_INTENTS_RESULT);
49 51
50 QueryMap::iterator it = queries_.find(h); 52 QueryMap::iterator it = queries_.find(h);
51 DCHECK(it != queries_.end()); 53 DCHECK(it != queries_.end());
52 54
53 IntentsQuery* query(it->second); 55 IntentsQuery* query(it->second);
54 DCHECK(query); 56 DCHECK(query);
55 queries_.erase(it); 57 queries_.erase(it);
56 58
57 // TODO(groby): Filtering goes here. 59 // TODO(groby): Filtering goes here.
58 IntentList matching_intents = static_cast< 60 IntentServiceList matching_intents = static_cast<
59 const WDResult<IntentList>*>(result)->GetValue(); 61 const WDResult<IntentServiceList>*>(result)->GetValue();
60 62
61 // Loop over all intents in all extensions, collect ones matching the query. 63 // Loop over all intents in all extensions, collect ones matching the query.
62 if (extension_service_) { 64 if (extension_service_) {
63 const ExtensionList* extensions = extension_service_->extensions(); 65 const ExtensionList* extensions = extension_service_->extensions();
64 if (extensions) { 66 if (extensions) {
65 for (ExtensionList::const_iterator i(extensions->begin()); 67 for (ExtensionList::const_iterator i(extensions->begin());
66 i != extensions->end(); ++i) { 68 i != extensions->end(); ++i) {
67 const IntentList& intents((*i)->intents()); 69 const IntentServiceList& intents((*i)->intents_services());
68 for (IntentList::const_iterator j(intents.begin()); 70 for (IntentServiceList::const_iterator j(intents.begin());
69 j != intents.end(); ++j) { 71 j != intents.end(); ++j) {
70 if (query->action_.empty() || query->action_ == j->action) 72 if (query->action_.empty() || query->action_ == j->action)
71 matching_intents.push_back(*j); 73 matching_intents.push_back(*j);
72 } 74 }
73 } 75 }
74 } 76 }
75 } 77 }
76 78
77 query->consumer_->OnIntentsQueryDone(query->query_id_, matching_intents); 79 query->consumer_->OnIntentsQueryDone(query->query_id_, matching_intents);
78 delete query; 80 delete query;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 const WebIntentServiceData& service) { 114 const WebIntentServiceData& service) {
113 DCHECK(wds_.get()); 115 DCHECK(wds_.get());
114 wds_->AddWebIntent(service); 116 wds_->AddWebIntent(service);
115 } 117 }
116 118
117 void WebIntentsRegistry::UnregisterIntentProvider( 119 void WebIntentsRegistry::UnregisterIntentProvider(
118 const WebIntentServiceData& service) { 120 const WebIntentServiceData& service) {
119 DCHECK(wds_.get()); 121 DCHECK(wds_.get());
120 wds_->RemoveWebIntent(service); 122 wds_->RemoveWebIntent(service);
121 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698