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

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

Issue 2666243002: Move GPUFeatureChecker to content layer (Closed)
Patch Set: rebase Created 3 years, 10 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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "base/version.h" 18 #include "base/version.h"
19 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" 19 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
20 #include "chrome/browser/extensions/crx_installer.h" 20 #include "chrome/browser/extensions/crx_installer.h"
21 #include "chrome/browser/extensions/extension_install_ui_util.h" 21 #include "chrome/browser/extensions/extension_install_ui_util.h"
22 #include "chrome/browser/extensions/extension_service.h" 22 #include "chrome/browser/extensions/extension_service.h"
23 #include "chrome/browser/extensions/extension_util.h" 23 #include "chrome/browser/extensions/extension_util.h"
24 #include "chrome/browser/extensions/install_tracker.h" 24 #include "chrome/browser/extensions/install_tracker.h"
25 #include "chrome/browser/gpu/gpu_feature_checker.h"
26 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/signin/signin_manager_factory.h" 26 #include "chrome/browser/signin/signin_manager_factory.h"
28 #include "chrome/browser/ui/app_list/app_list_service.h" 27 #include "chrome/browser/ui/app_list/app_list_service.h"
29 #include "chrome/browser/ui/app_list/app_list_util.h" 28 #include "chrome/browser/ui/app_list/app_list_util.h"
30 #include "chrome/common/extensions/extension_constants.h" 29 #include "chrome/common/extensions/extension_constants.h"
31 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
32 #include "components/crx_file/id_util.h" 31 #include "components/crx_file/id_util.h"
33 #include "components/prefs/pref_service.h" 32 #include "components/prefs/pref_service.h"
34 #include "components/signin/core/browser/signin_manager.h" 33 #include "components/signin/core/browser/signin_manager.h"
34 #include "content/public/browser/gpu_feature_checker.h"
35 #include "content/public/browser/storage_partition.h" 35 #include "content/public/browser/storage_partition.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "extensions/browser/extension_registry.h" 37 #include "extensions/browser/extension_registry.h"
38 #include "extensions/browser/extension_system.h" 38 #include "extensions/browser/extension_system.h"
39 #include "extensions/common/extension.h" 39 #include "extensions/common/extension.h"
40 #include "net/base/load_flags.h" 40 #include "net/base/load_flags.h"
41 #include "net/url_request/url_request.h" 41 #include "net/url_request/url_request.h"
42 #include "url/gurl.h" 42 #include "url/gurl.h"
43 43
44 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 44 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 ExtensionFunction::ResponseAction WebstorePrivateSetStoreLoginFunction::Run() { 538 ExtensionFunction::ResponseAction WebstorePrivateSetStoreLoginFunction::Run() {
539 std::unique_ptr<SetStoreLogin::Params> params( 539 std::unique_ptr<SetStoreLogin::Params> params(
540 SetStoreLogin::Params::Create(*args_)); 540 SetStoreLogin::Params::Create(*args_));
541 EXTENSION_FUNCTION_VALIDATE(params); 541 EXTENSION_FUNCTION_VALIDATE(params);
542 SetWebstoreLogin(chrome_details_.GetProfile(), params->login); 542 SetWebstoreLogin(chrome_details_.GetProfile(), params->login);
543 return RespondNow(NoArguments()); 543 return RespondNow(NoArguments());
544 } 544 }
545 545
546 WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction() 546 WebstorePrivateGetWebGLStatusFunction::WebstorePrivateGetWebGLStatusFunction()
547 : feature_checker_(new GPUFeatureChecker( 547 : feature_checker_(content::GpuFeatureChecker::Create(
548 gpu::GPU_FEATURE_TYPE_WEBGL, 548 gpu::GPU_FEATURE_TYPE_WEBGL,
549 base::Bind(&WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck, 549 base::Bind(&WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck,
550 base::Unretained(this)))) { 550 base::Unretained(this)))) {}
551 }
552 551
553 WebstorePrivateGetWebGLStatusFunction:: 552 WebstorePrivateGetWebGLStatusFunction::
554 ~WebstorePrivateGetWebGLStatusFunction() {} 553 ~WebstorePrivateGetWebGLStatusFunction() {}
555 554
556 ExtensionFunction::ResponseAction WebstorePrivateGetWebGLStatusFunction::Run() { 555 ExtensionFunction::ResponseAction WebstorePrivateGetWebGLStatusFunction::Run() {
557 feature_checker_->CheckGPUFeatureAvailability(); 556 feature_checker_->CheckGpuFeatureAvailability();
558 return RespondLater(); 557 return RespondLater();
559 } 558 }
560 559
561 void WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck( 560 void WebstorePrivateGetWebGLStatusFunction::OnFeatureCheck(
562 bool feature_allowed) { 561 bool feature_allowed) {
563 Respond(ArgumentList( 562 Respond(ArgumentList(
564 GetWebGLStatus::Results::Create(api::webstore_private::ParseWebGlStatus( 563 GetWebGLStatus::Results::Create(api::webstore_private::ParseWebGlStatus(
565 feature_allowed ? "webgl_allowed" : "webgl_blocked")))); 564 feature_allowed ? "webgl_allowed" : "webgl_blocked"))));
566 } 565 }
567 566
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 652
654 return RespondNow(BuildResponse(is_pending_approval)); 653 return RespondNow(BuildResponse(is_pending_approval));
655 } 654 }
656 655
657 ExtensionFunction::ResponseValue 656 ExtensionFunction::ResponseValue
658 WebstorePrivateIsPendingCustodianApprovalFunction::BuildResponse(bool result) { 657 WebstorePrivateIsPendingCustodianApprovalFunction::BuildResponse(bool result) {
659 return OneArgument(base::MakeUnique<base::FundamentalValue>(result)); 658 return OneArgument(base::MakeUnique<base::FundamentalValue>(result));
660 } 659 }
661 660
662 } // namespace extensions 661 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698