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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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 | Annotate | Revision Log
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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/browser/signin/signin_manager_factory.h" 29 #include "chrome/browser/signin/signin_manager_factory.h"
30 #include "chrome/browser/signin/signin_promo.h" 30 #include "chrome/browser/signin/signin_promo.h"
31 #include "chrome/browser/signin/signin_tracker_factory.h" 31 #include "chrome/browser/signin/signin_tracker_factory.h"
32 #include "chrome/browser/sync/profile_sync_service.h" 32 #include "chrome/browser/sync/profile_sync_service.h"
33 #include "chrome/browser/sync/profile_sync_service_factory.h" 33 #include "chrome/browser/sync/profile_sync_service_factory.h"
34 #include "chrome/browser/ui/app_list/app_list_service.h" 34 #include "chrome/browser/ui/app_list/app_list_service.h"
35 #include "chrome/browser/ui/app_list/app_list_util.h" 35 #include "chrome/browser/ui/app_list/app_list_util.h"
36 #include "chrome/browser/ui/browser.h" 36 #include "chrome/browser/ui/browser.h"
37 #include "chrome/common/extensions/extension_constants.h" 37 #include "chrome/common/extensions/extension_constants.h"
38 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
39 #include "components/crx_file/id_util.h"
39 #include "components/signin/core/browser/signin_manager.h" 40 #include "components/signin/core/browser/signin_manager.h"
40 #include "components/signin/core/common/profile_management_switches.h" 41 #include "components/signin/core/common/profile_management_switches.h"
41 #include "content/public/browser/gpu_data_manager.h" 42 #include "content/public/browser/gpu_data_manager.h"
42 #include "content/public/browser/notification_details.h" 43 #include "content/public/browser/notification_details.h"
43 #include "content/public/browser/notification_source.h" 44 #include "content/public/browser/notification_source.h"
44 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
45 #include "content/public/common/page_transition_types.h" 46 #include "content/public/common/page_transition_types.h"
46 #include "content/public/common/referrer.h" 47 #include "content/public/common/referrer.h"
47 #include "extensions/browser/extension_function_dispatcher.h" 48 #include "extensions/browser/extension_function_dispatcher.h"
48 #include "extensions/browser/extension_prefs.h" 49 #include "extensions/browser/extension_prefs.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 } 231 }
231 232
232 WebstorePrivateBeginInstallWithManifest3Function:: 233 WebstorePrivateBeginInstallWithManifest3Function::
233 ~WebstorePrivateBeginInstallWithManifest3Function() { 234 ~WebstorePrivateBeginInstallWithManifest3Function() {
234 } 235 }
235 236
236 bool WebstorePrivateBeginInstallWithManifest3Function::RunAsync() { 237 bool WebstorePrivateBeginInstallWithManifest3Function::RunAsync() {
237 params_ = BeginInstallWithManifest3::Params::Create(*args_); 238 params_ = BeginInstallWithManifest3::Params::Create(*args_);
238 EXTENSION_FUNCTION_VALIDATE(params_); 239 EXTENSION_FUNCTION_VALIDATE(params_);
239 240
240 if (!extensions::Extension::IdIsValid(params_->details.id)) { 241 if (!crx_file::id_util::IdIsValid(params_->details.id)) {
241 SetResultCode(INVALID_ID); 242 SetResultCode(INVALID_ID);
242 error_ = kInvalidIdError; 243 error_ = kInvalidIdError;
243 return false; 244 return false;
244 } 245 }
245 246
246 if (params_->details.icon_data && params_->details.icon_url) { 247 if (params_->details.icon_data && params_->details.icon_url) {
247 SetResultCode(ICON_ERROR); 248 SetResultCode(ICON_ERROR);
248 error_ = kCannotSpecifyIconDataAndUrlError; 249 error_ = kCannotSpecifyIconDataAndUrlError;
249 return false; 250 return false;
250 } 251 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 WebstorePrivateCompleteInstallFunction:: 502 WebstorePrivateCompleteInstallFunction::
502 WebstorePrivateCompleteInstallFunction() {} 503 WebstorePrivateCompleteInstallFunction() {}
503 504
504 WebstorePrivateCompleteInstallFunction:: 505 WebstorePrivateCompleteInstallFunction::
505 ~WebstorePrivateCompleteInstallFunction() {} 506 ~WebstorePrivateCompleteInstallFunction() {}
506 507
507 bool WebstorePrivateCompleteInstallFunction::RunAsync() { 508 bool WebstorePrivateCompleteInstallFunction::RunAsync() {
508 scoped_ptr<CompleteInstall::Params> params( 509 scoped_ptr<CompleteInstall::Params> params(
509 CompleteInstall::Params::Create(*args_)); 510 CompleteInstall::Params::Create(*args_));
510 EXTENSION_FUNCTION_VALIDATE(params); 511 EXTENSION_FUNCTION_VALIDATE(params);
511 if (!extensions::Extension::IdIsValid(params->expected_id)) { 512 if (!crx_file::id_util::IdIsValid(params->expected_id)) {
512 error_ = kInvalidIdError; 513 error_ = kInvalidIdError;
513 return false; 514 return false;
514 } 515 }
515 516
516 approval_ = g_pending_approvals.Get() 517 approval_ = g_pending_approvals.Get()
517 .PopApproval(GetProfile(), params->expected_id) 518 .PopApproval(GetProfile(), params->expected_id)
518 .Pass(); 519 .Pass();
519 if (!approval_) { 520 if (!approval_) {
520 error_ = ErrorUtils::FormatErrorMessage( 521 error_ = ErrorUtils::FormatErrorMessage(
521 kNoPreviousBeginInstallWithManifestError, params->expected_id); 522 kNoPreviousBeginInstallWithManifestError, params->expected_id);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 WebstorePrivateGetEphemeralAppsEnabledFunction:: 902 WebstorePrivateGetEphemeralAppsEnabledFunction::
902 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {} 903 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {}
903 904
904 bool WebstorePrivateGetEphemeralAppsEnabledFunction::RunSync() { 905 bool WebstorePrivateGetEphemeralAppsEnabledFunction::RunSync() {
905 results_ = GetEphemeralAppsEnabled::Results::Create( 906 results_ = GetEphemeralAppsEnabled::Results::Create(
906 EphemeralAppLauncher::IsFeatureEnabled()); 907 EphemeralAppLauncher::IsFeatureEnabled());
907 return true; 908 return true;
908 } 909 }
909 910
910 } // namespace extensions 911 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698