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

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

Issue 10911331: Using API keys for requests to Chrome Web Store. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove the internal version of intents/api_key. Created 8 years, 3 months 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
« no previous file with comments | « chrome/browser/intents/api_key.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/extensions/extension_l10n_util.h" 13 #include "chrome/common/extensions/extension_l10n_util.h"
14 #include "chrome/common/extensions/message_bundle.h" 14 #include "chrome/common/extensions/message_bundle.h"
15 #include "chrome/browser/intents/api_key.h"
16 #include "chrome/browser/net/chrome_url_request_context.h" 15 #include "chrome/browser/net/chrome_url_request_context.h"
17 #include "chrome/browser/webdata/web_data_service.h" 16 #include "chrome/browser/webdata/web_data_service.h"
18 #include "chrome/common/net/url_util.h" 17 #include "chrome/common/net/url_util.h"
18 #include "google_apis/google_api_keys.h"
19 #include "net/base/load_flags.h" 19 #include "net/base/load_flags.h"
20 #include "net/base/mime_util.h" 20 #include "net/base/mime_util.h"
21 #include "net/url_request/url_fetcher.h" 21 #include "net/url_request/url_fetcher.h"
22 22
23 namespace { 23 namespace {
24 24
25 // Limit for the number of suggestions we fix from CWS. Ideally, the registry 25 // Limit for the number of suggestions we fix from CWS. Ideally, the registry
26 // simply get all of them, but there is a) chunking on the CWS side, and b) 26 // simply get all of them, but there is a) chunking on the CWS side, and b)
27 // there is a cost with suggestions fetched. (Network overhead for favicons, 27 // there is a cost with suggestions fetched. (Network overhead for favicons,
28 // roundtrips to registry to check if installed). 28 // roundtrips to registry to check if installed).
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 const string16& type) { 226 const string16& type) {
227 GURL request(kCWSIntentServiceURL); 227 GURL request(kCWSIntentServiceURL);
228 request = chrome_common_net::AppendQueryParameter(request, "intent", 228 request = chrome_common_net::AppendQueryParameter(request, "intent",
229 UTF16ToUTF8(action)); 229 UTF16ToUTF8(action));
230 request = chrome_common_net::AppendQueryParameter(request, "mime_types", 230 request = chrome_common_net::AppendQueryParameter(request, "mime_types",
231 UTF16ToUTF8(type)); 231 UTF16ToUTF8(type));
232 request = chrome_common_net::AppendQueryParameter(request, "start_index", 232 request = chrome_common_net::AppendQueryParameter(request, "start_index",
233 "0"); 233 "0");
234 request = chrome_common_net::AppendQueryParameter(request, "num_results", 234 request = chrome_common_net::AppendQueryParameter(request, "num_results",
235 kMaxSuggestions); 235 kMaxSuggestions);
236 if (web_intents::kApiKey[0]) { 236 request = chrome_common_net::AppendQueryParameter(request, "key",
237 request = chrome_common_net::AppendQueryParameter(request, "key", 237 google_apis::GetAPIKey());
238 web_intents::kApiKey);
239 }
240 238
241 return request; 239 return request;
242 } 240 }
OLDNEW
« no previous file with comments | « chrome/browser/intents/api_key.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698