OLD | NEW |
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 #include "chrome/browser/intents/cws_intents_registry.h" | 5 #include "chrome/browser/intents/cws_intents_registry.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 CWSIntentsRegistry::CWSIntentsRegistry(net::URLRequestContextGetter* context) | 55 CWSIntentsRegistry::CWSIntentsRegistry(net::URLRequestContextGetter* context) |
56 : request_context_(context) { | 56 : request_context_(context) { |
57 } | 57 } |
58 | 58 |
59 CWSIntentsRegistry::~CWSIntentsRegistry() { | 59 CWSIntentsRegistry::~CWSIntentsRegistry() { |
60 // Cancel all pending queries, since we can't handle them any more. | 60 // Cancel all pending queries, since we can't handle them any more. |
61 STLDeleteValues(&queries_); | 61 STLDeleteValues(&queries_); |
62 } | 62 } |
63 | 63 |
64 void CWSIntentsRegistry::OnURLFetchComplete(const content::URLFetcher* source) { | 64 void CWSIntentsRegistry::OnURLFetchComplete(const net::URLFetcher* source) { |
65 DCHECK(source); | 65 DCHECK(source); |
66 | 66 |
67 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>(source); | 67 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>(source); |
68 QueryMap::iterator it = queries_.find(handle); | 68 QueryMap::iterator it = queries_.find(handle); |
69 DCHECK(it != queries_.end()); | 69 DCHECK(it != queries_.end()); |
70 scoped_ptr<IntentsQuery> query(it->second); | 70 scoped_ptr<IntentsQuery> query(it->second); |
71 DCHECK(query.get() != NULL); | 71 DCHECK(query.get() != NULL); |
72 queries_.erase(it); | 72 queries_.erase(it); |
73 | 73 |
74 std::string response; | 74 std::string response; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 UTF16ToUTF8(action)); | 165 UTF16ToUTF8(action)); |
166 request = chrome_common_net::AppendQueryParameter(request, "mime_types", | 166 request = chrome_common_net::AppendQueryParameter(request, "mime_types", |
167 UTF16ToUTF8(type)); | 167 UTF16ToUTF8(type)); |
168 if (web_intents::kApiKey[0]) { | 168 if (web_intents::kApiKey[0]) { |
169 request = chrome_common_net::AppendQueryParameter(request, "key", | 169 request = chrome_common_net::AppendQueryParameter(request, "key", |
170 web_intents::kApiKey); | 170 web_intents::kApiKey); |
171 } | 171 } |
172 | 172 |
173 return request; | 173 return request; |
174 } | 174 } |
OLD | NEW |