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

Side by Side Diff: chrome/browser/extensions/requirements_checker.cc

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/requirements_checker.h" 5 #include "chrome/browser/extensions/requirements_checker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/gpu/gpu_feature_checker.h" 9 #include "chrome/browser/gpu/gpu_feature_checker.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
(...skipping 17 matching lines...) Expand all
28 28
29 RequirementsChecker::~RequirementsChecker() { 29 RequirementsChecker::~RequirementsChecker() {
30 } 30 }
31 31
32 void RequirementsChecker::Check(scoped_refptr<const Extension> extension, 32 void RequirementsChecker::Check(scoped_refptr<const Extension> extension,
33 base::Callback<void(std::vector<std::string> errors)> callback) { 33 base::Callback<void(std::vector<std::string> errors)> callback) {
34 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 34 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
35 35
36 callback_ = callback; 36 callback_ = callback;
37 const RequirementsInfo& requirements = 37 const RequirementsInfo& requirements =
38 RequirementsInfo::GetRequirements(extension); 38 RequirementsInfo::GetRequirements(extension.get());
39 39
40 if (requirements.npapi) { 40 if (requirements.npapi) {
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 errors_.push_back( 42 errors_.push_back(
43 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); 43 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED));
44 #endif // defined(OS_CHROMEOS) 44 #endif // defined(OS_CHROMEOS)
45 #if defined(OS_WIN) 45 #if defined(OS_WIN)
46 if (base::win::IsMetroProcess()) { 46 if (base::win::IsMetroProcess()) {
47 errors_.push_back( 47 errors_.push_back(
48 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED)); 48 l10n_util::GetStringUTF8(IDS_EXTENSION_NPAPI_NOT_SUPPORTED));
(...skipping 19 matching lines...) Expand all
68 68
69 if (pending_requirement_checks_ == 0) { 69 if (pending_requirement_checks_ == 0) {
70 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 70 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
71 base::Bind(callback_, errors_)); 71 base::Bind(callback_, errors_));
72 // Reset the callback so any ref-counted bound parameters will get released. 72 // Reset the callback so any ref-counted bound parameters will get released.
73 callback_.Reset(); 73 callback_.Reset();
74 return; 74 return;
75 } 75 }
76 // Running the GPU checkers down here removes any race condition that arises 76 // Running the GPU checkers down here removes any race condition that arises
77 // from the use of pending_requirement_checks_. 77 // from the use of pending_requirement_checks_.
78 if (webgl_checker_) 78 if (webgl_checker_.get())
79 webgl_checker_->CheckGPUFeatureAvailability(); 79 webgl_checker_->CheckGPUFeatureAvailability();
80 if (css3d_checker_) 80 if (css3d_checker_.get())
81 css3d_checker_->CheckGPUFeatureAvailability(); 81 css3d_checker_->CheckGPUFeatureAvailability();
82 } 82 }
83 83
84 void RequirementsChecker::SetWebGLAvailability(bool available) { 84 void RequirementsChecker::SetWebGLAvailability(bool available) {
85 if (!available) { 85 if (!available) {
86 errors_.push_back( 86 errors_.push_back(
87 l10n_util::GetStringUTF8(IDS_EXTENSION_WEBGL_NOT_SUPPORTED)); 87 l10n_util::GetStringUTF8(IDS_EXTENSION_WEBGL_NOT_SUPPORTED));
88 } 88 }
89 MaybeRunCallback(); 89 MaybeRunCallback();
90 } 90 }
(...skipping 10 matching lines...) Expand all
101 if (--pending_requirement_checks_ == 0) { 101 if (--pending_requirement_checks_ == 0) {
102 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 102 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
103 base::Bind(callback_, errors_)); 103 base::Bind(callback_, errors_));
104 // Reset the callback so any ref-counted bound parameters will get released. 104 // Reset the callback so any ref-counted bound parameters will get released.
105 callback_.Reset(); 105 callback_.Reset();
106 errors_.clear(); 106 errors_.clear();
107 } 107 }
108 } 108 }
109 109
110 } // namespace extensions 110 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/permissions_updater_unittest.cc ('k') | chrome/browser/extensions/sandboxed_unpacker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698