| 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 #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 // Internal object representing all data associated with a single query. | 8 // Internal object representing all data associated with a single query. |
| 9 struct WebIntentsRegistry::IntentsQuery { | 9 struct WebIntentsRegistry::IntentsQuery { |
| 10 // Unique query identifier. | 10 // Unique query identifier. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 DCHECK(result->GetType() == WEB_INTENTS_RESULT); | 41 DCHECK(result->GetType() == WEB_INTENTS_RESULT); |
| 42 | 42 |
| 43 QueryMap::iterator it = queries_.find(h); | 43 QueryMap::iterator it = queries_.find(h); |
| 44 DCHECK(it != queries_.end()); | 44 DCHECK(it != queries_.end()); |
| 45 | 45 |
| 46 IntentsQuery* query(it->second); | 46 IntentsQuery* query(it->second); |
| 47 DCHECK(query); | 47 DCHECK(query); |
| 48 queries_.erase(it); | 48 queries_.erase(it); |
| 49 | 49 |
| 50 // TODO(groby): Filtering goes here. | 50 // TODO(groby): Filtering goes here. |
| 51 std::vector<WebIntentData> intents = static_cast< | 51 std::vector<WebIntentServiceData> intents = static_cast< |
| 52 const WDResult<std::vector<WebIntentData> >*>(result)->GetValue(); | 52 const WDResult<std::vector<WebIntentServiceData> >*>(result)->GetValue(); |
| 53 | 53 |
| 54 query->consumer_->OnIntentsQueryDone(query->query_id_, intents); | 54 query->consumer_->OnIntentsQueryDone(query->query_id_, intents); |
| 55 delete query; | 55 delete query; |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebIntentsRegistry::QueryID WebIntentsRegistry::GetIntentProviders( | 58 WebIntentsRegistry::QueryID WebIntentsRegistry::GetIntentProviders( |
| 59 const string16& action, | 59 const string16& action, |
| 60 Consumer* consumer) { | 60 Consumer* consumer) { |
| 61 DCHECK(consumer); | 61 DCHECK(consumer); |
| 62 DCHECK(wds_.get()); | 62 DCHECK(wds_.get()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 77 | 77 |
| 78 IntentsQuery* query = new IntentsQuery; | 78 IntentsQuery* query = new IntentsQuery; |
| 79 query->query_id_ = next_query_id_++; | 79 query->query_id_ = next_query_id_++; |
| 80 query->consumer_ = consumer; | 80 query->consumer_ = consumer; |
| 81 query->pending_query_ = wds_->GetAllWebIntents(this); | 81 query->pending_query_ = wds_->GetAllWebIntents(this); |
| 82 queries_[query->pending_query_] = query; | 82 queries_[query->pending_query_] = query; |
| 83 | 83 |
| 84 return query->query_id_; | 84 return query->query_id_; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void WebIntentsRegistry::RegisterIntentProvider(const WebIntentData& intent) { | 87 void WebIntentsRegistry::RegisterIntentProvider( |
| 88 const WebIntentServiceData& service) { |
| 88 DCHECK(wds_.get()); | 89 DCHECK(wds_.get()); |
| 89 wds_->AddWebIntent(intent); | 90 wds_->AddWebIntent(service); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void WebIntentsRegistry::UnregisterIntentProvider(const WebIntentData& intent) { | 93 void WebIntentsRegistry::UnregisterIntentProvider( |
| 94 const WebIntentServiceData& service) { |
| 93 DCHECK(wds_.get()); | 95 DCHECK(wds_.get()); |
| 94 wds_->RemoveWebIntent(intent); | 96 wds_->RemoveWebIntent(service); |
| 95 } | 97 } |
| OLD | NEW |