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/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" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/extensions/crx_installer.h" | 15 #include "chrome/browser/extensions/crx_installer.h" |
16 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 16 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
17 #include "chrome/browser/extensions/extension_prefs.h" | 17 #include "chrome/browser/extensions/extension_prefs.h" |
18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
19 #include "chrome/browser/extensions/webstore_installer.h" | 19 #include "chrome/browser/extensions/webstore_installer.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/signin/token_service.h" | 22 #include "chrome/browser/signin/token_service.h" |
23 #include "chrome/browser/signin/token_service_factory.h" | 23 #include "chrome/browser/signin/token_service_factory.h" |
24 #include "chrome/browser/sync/profile_sync_service.h" | 24 #include "chrome/browser/sync/profile_sync_service.h" |
25 #include "chrome/browser/sync/profile_sync_service_factory.h" | 25 #include "chrome/browser/sync/profile_sync_service_factory.h" |
26 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/extensions/extension_constants.h" | 28 #include "chrome/common/extensions/extension_constants.h" |
29 #include "chrome/common/extensions/extension_error_utils.h" | |
30 #include "chrome/common/extensions/extension_l10n_util.h" | 29 #include "chrome/common/extensions/extension_l10n_util.h" |
31 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
32 #include "content/public/browser/gpu_data_manager.h" | 31 #include "content/public/browser/gpu_data_manager.h" |
33 #include "content/public/browser/notification_details.h" | 32 #include "content/public/browser/notification_details.h" |
34 #include "content/public/browser/notification_source.h" | 33 #include "content/public/browser/notification_source.h" |
35 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 35 #include "extensions/common/error_utils.h" |
36 #include "google_apis/gaia/gaia_constants.h" | 36 #include "google_apis/gaia/gaia_constants.h" |
37 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 | 40 |
41 using content::GpuDataManager; | 41 using content::GpuDataManager; |
42 | 42 |
43 namespace extensions { | 43 namespace extensions { |
44 | 44 |
45 namespace { | 45 namespace { |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 std::string id; | 413 std::string id; |
414 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); | 414 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); |
415 if (!extensions::Extension::IdIsValid(id)) { | 415 if (!extensions::Extension::IdIsValid(id)) { |
416 error_ = kInvalidIdError; | 416 error_ = kInvalidIdError; |
417 return false; | 417 return false; |
418 } | 418 } |
419 | 419 |
420 scoped_ptr<WebstoreInstaller::Approval> approval( | 420 scoped_ptr<WebstoreInstaller::Approval> approval( |
421 g_pending_approvals.Get().PopApproval(profile(), id)); | 421 g_pending_approvals.Get().PopApproval(profile(), id)); |
422 if (!approval.get()) { | 422 if (!approval.get()) { |
423 error_ = ExtensionErrorUtils::FormatErrorMessage( | 423 error_ = ErrorUtils::FormatErrorMessage( |
424 kNoPreviousBeginInstallWithManifestError, id); | 424 kNoPreviousBeginInstallWithManifestError, id); |
425 return false; | 425 return false; |
426 } | 426 } |
427 | 427 |
428 AddRef(); | 428 AddRef(); |
429 | 429 |
430 // The extension will install through the normal extension install flow, but | 430 // The extension will install through the normal extension install flow, but |
431 // the whitelist entry will bypass the normal permissions install dialog. | 431 // the whitelist entry will bypass the normal permissions install dialog. |
432 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( | 432 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( |
433 profile(), this, | 433 profile(), this, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 feature_checker_->CheckGPUFeatureAvailability(); | 510 feature_checker_->CheckGPUFeatureAvailability(); |
511 return true; | 511 return true; |
512 } | 512 } |
513 | 513 |
514 void GetWebGLStatusFunction::OnFeatureCheck(bool feature_allowed) { | 514 void GetWebGLStatusFunction::OnFeatureCheck(bool feature_allowed) { |
515 CreateResult(feature_allowed); | 515 CreateResult(feature_allowed); |
516 SendResponse(true); | 516 SendResponse(true); |
517 } | 517 } |
518 | 518 |
519 } // namespace extensions | 519 } // namespace extensions |
OLD | NEW |