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

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: 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"
19 #include "net/base/load_flags.h" 18 #include "net/base/load_flags.h"
20 #include "net/base/mime_util.h" 19 #include "net/base/mime_util.h"
21 #include "net/url_request/url_fetcher.h" 20 #include "net/url_request/url_fetcher.h"
22 21
22 // Forward declaration.
Jói 2012/09/17 16:56:19 Seems simpler to just #include (and update DEPS if
Greg Billock 2012/09/17 17:52:18 Yes, let's #include
23 namespace google_apis {
24 std::string GetAPIKey();
25 }
26
23 namespace { 27 namespace {
24 28
25 // Limit for the number of suggestions we fix from CWS. Ideally, the registry 29 // 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) 30 // 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, 31 // there is a cost with suggestions fetched. (Network overhead for favicons,
28 // roundtrips to registry to check if installed). 32 // roundtrips to registry to check if installed).
29 // 33 //
30 // Since the picker limits the number of suggestions displayed to 5, 15 means 34 // Since the picker limits the number of suggestions displayed to 5, 15 means
31 // the suggestion list only has the potential to be shorter than that once the 35 // the suggestion list only has the potential to be shorter than that once the
32 // user has at least 10 installed handlers for the particular action/type. 36 // user has at least 10 installed handlers for the particular action/type.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 const string16& type) { 230 const string16& type) {
227 GURL request(kCWSIntentServiceURL); 231 GURL request(kCWSIntentServiceURL);
228 request = chrome_common_net::AppendQueryParameter(request, "intent", 232 request = chrome_common_net::AppendQueryParameter(request, "intent",
229 UTF16ToUTF8(action)); 233 UTF16ToUTF8(action));
230 request = chrome_common_net::AppendQueryParameter(request, "mime_types", 234 request = chrome_common_net::AppendQueryParameter(request, "mime_types",
231 UTF16ToUTF8(type)); 235 UTF16ToUTF8(type));
232 request = chrome_common_net::AppendQueryParameter(request, "start_index", 236 request = chrome_common_net::AppendQueryParameter(request, "start_index",
233 "0"); 237 "0");
234 request = chrome_common_net::AppendQueryParameter(request, "num_results", 238 request = chrome_common_net::AppendQueryParameter(request, "num_results",
235 kMaxSuggestions); 239 kMaxSuggestions);
236 if (web_intents::kApiKey[0]) { 240 request = chrome_common_net::AppendQueryParameter(request, "key",
237 request = chrome_common_net::AppendQueryParameter(request, "key", 241 google_apis::GetAPIKey());
Steve McKay 2012/09/17 17:01:43 Question, for Jói mostly. In the past when we need
238 web_intents::kApiKey);
239 }
240 242
241 return request; 243 return request;
242 } 244 }
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