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" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/intents/api_key.h" | 13 #include "chrome/browser/intents/api_key.h" |
14 #include "chrome/browser/net/browser_url_util.h" | |
15 #include "chrome/browser/net/chrome_url_request_context.h" | 14 #include "chrome/browser/net/chrome_url_request_context.h" |
16 #include "chrome/browser/webdata/web_data_service.h" | 15 #include "chrome/browser/webdata/web_data_service.h" |
| 16 #include "chrome/common/net/url_util.h" |
17 #include "content/public/common/url_fetcher.h" | 17 #include "content/public/common/url_fetcher.h" |
| 18 #include "net/base/load_flags.h" |
18 #include "net/base/mime_util.h" | 19 #include "net/base/mime_util.h" |
19 #include "net/base/load_flags.h" | |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // URL for CWS intents API. | 23 // URL for CWS intents API. |
24 const char kCWSIntentServiceURL[] = | 24 const char kCWSIntentServiceURL[] = |
25 "https://www.googleapis.com/chromewebstore/v1.1b/items/intent"; | 25 "https://www.googleapis.com/chromewebstore/v1.1b/items/intent"; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 // Internal object representing all data associated with a single query. | 29 // Internal object representing all data associated with a single query. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>( | 154 URLFetcherHandle handle = reinterpret_cast<URLFetcherHandle>( |
155 query->url_fetcher.get()); | 155 query->url_fetcher.get()); |
156 queries_[handle] = query.release(); | 156 queries_[handle] = query.release(); |
157 queries_[handle]->url_fetcher->Start(); | 157 queries_[handle]->url_fetcher->Start(); |
158 } | 158 } |
159 | 159 |
160 // static | 160 // static |
161 GURL CWSIntentsRegistry::BuildQueryURL(const string16& action, | 161 GURL CWSIntentsRegistry::BuildQueryURL(const string16& action, |
162 const string16& type) { | 162 const string16& type) { |
163 GURL request(kCWSIntentServiceURL); | 163 GURL request(kCWSIntentServiceURL); |
164 request = chrome_browser_net::AppendQueryParameter(request, "intent", | 164 request = chrome_common_net::AppendQueryParameter(request, "intent", |
165 UTF16ToUTF8(action)); | 165 UTF16ToUTF8(action)); |
166 request = chrome_browser_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_browser_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 |