| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 IntentsQuery* query = new IntentsQuery; | 64 IntentsQuery* query = new IntentsQuery; |
| 65 query->query_id_ = next_query_id_++; | 65 query->query_id_ = next_query_id_++; |
| 66 query->consumer_ = consumer; | 66 query->consumer_ = consumer; |
| 67 query->pending_query_ = wds_->GetWebIntents(action, this); | 67 query->pending_query_ = wds_->GetWebIntents(action, this); |
| 68 queries_[query->pending_query_] = query; | 68 queries_[query->pending_query_] = query; |
| 69 | 69 |
| 70 return query->query_id_; | 70 return query->query_id_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 WebIntentsRegistry::QueryID WebIntentsRegistry::GetAllIntentProviders( |
| 74 Consumer* consumer) { |
| 75 DCHECK(consumer); |
| 76 DCHECK(wds_.get()); |
| 77 |
| 78 IntentsQuery* query = new IntentsQuery; |
| 79 query->query_id_ = next_query_id_++; |
| 80 query->consumer_ = consumer; |
| 81 query->pending_query_ = wds_->GetAllWebIntents(this); |
| 82 queries_[query->pending_query_] = query; |
| 83 |
| 84 return query->query_id_; |
| 85 } |
| 86 |
| 73 void WebIntentsRegistry::RegisterIntentProvider(const WebIntentData& intent) { | 87 void WebIntentsRegistry::RegisterIntentProvider(const WebIntentData& intent) { |
| 74 DCHECK(wds_.get()); | 88 DCHECK(wds_.get()); |
| 75 wds_->AddWebIntent(intent); | 89 wds_->AddWebIntent(intent); |
| 76 } | 90 } |
| 77 | 91 |
| 78 void WebIntentsRegistry::UnregisterIntentProvider(const WebIntentData& intent) { | 92 void WebIntentsRegistry::UnregisterIntentProvider(const WebIntentData& intent) { |
| 79 DCHECK(wds_.get()); | 93 DCHECK(wds_.get()); |
| 80 wds_->RemoveWebIntent(intent); | 94 wds_->RemoveWebIntent(intent); |
| 81 } | 95 } |
| OLD | NEW |