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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_api.cc

Issue 931993002: Make image_decoder a Leaky LazyInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a few comments Created 5 years, 9 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
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/extensions/api/webstore_private/webstore_private_api.h" 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 GURL icon_url; 255 GURL icon_url;
256 if (params_->details.icon_url) { 256 if (params_->details.icon_url) {
257 icon_url = source_url().Resolve(*params_->details.icon_url); 257 icon_url = source_url().Resolve(*params_->details.icon_url);
258 if (!icon_url.is_valid()) { 258 if (!icon_url.is_valid()) {
259 return RespondNow(BuildResponse( 259 return RespondNow(BuildResponse(
260 api::webstore_private::RESULT_INVALID_ICON_URL, 260 api::webstore_private::RESULT_INVALID_ICON_URL,
261 kInvalidIconUrlError)); 261 kInvalidIconUrlError));
262 } 262 }
263 } 263 }
264 264
265 std::string icon_data = params_->details.icon_data ?
266 *params_->details.icon_data : std::string();
267
268 ExtensionFunction::ResponseValue response = RunExtraForResponse(); 265 ExtensionFunction::ResponseValue response = RunExtraForResponse();
269 if (response) 266 if (response)
270 return RespondNow(response.Pass()); 267 return RespondNow(response.Pass());
271 268
272 net::URLRequestContextGetter* context_getter = NULL; 269 net::URLRequestContextGetter* context_getter = NULL;
273 if (!icon_url.is_empty()) 270 if (!icon_url.is_empty())
274 context_getter = browser_context()->GetRequestContext(); 271 context_getter = browser_context()->GetRequestContext();
275 272
276 scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper( 273 scoped_refptr<WebstoreInstallHelper> helper = new WebstoreInstallHelper(
277 this, params_->details.id, params_->details.manifest, icon_data, icon_url, 274 this, params_->details.id, params_->details.manifest, icon_url,
278 context_getter); 275 context_getter);
279 276
280 // The helper will call us back via OnWebstoreParseSuccess or 277 // The helper will call us back via OnWebstoreParseSuccess or
281 // OnWebstoreParseFailure. 278 // OnWebstoreParseFailure.
282 helper->Start(); 279 helper->Start();
283 280
284 // Matched with a Release in OnWebstoreParseSuccess/OnWebstoreParseFailure. 281 // Matched with a Release in OnWebstoreParseSuccess/OnWebstoreParseFailure.
285 AddRef(); 282 AddRef();
286 283
287 // The response is sent asynchronously in OnWebstoreParseSuccess/ 284 // The response is sent asynchronously in OnWebstoreParseSuccess/
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 WebstorePrivateGetEphemeralAppsEnabledFunction:: 759 WebstorePrivateGetEphemeralAppsEnabledFunction::
763 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {} 760 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {}
764 761
765 ExtensionFunction::ResponseAction 762 ExtensionFunction::ResponseAction
766 WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { 763 WebstorePrivateGetEphemeralAppsEnabledFunction::Run() {
767 return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create( 764 return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create(
768 EphemeralAppLauncher::IsFeatureEnabled()))); 765 EphemeralAppLauncher::IsFeatureEnabled())));
769 } 766 }
770 767
771 } // namespace extensions 768 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698