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

Side by Side Diff: chrome/common/extensions/features/complex_feature.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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/common/extensions/features/complex_feature.h" 5 #include "chrome/common/extensions/features/complex_feature.h"
6 6
7 #include "chrome/common/extensions/features/simple_feature.h" 7 #include "chrome/common/extensions/features/simple_feature.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) { 11 ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) {
12 DCHECK_GT(features->size(), 0UL); 12 DCHECK_GT(features->size(), 0UL);
13 features_.swap(*features); 13 features_.swap(*features);
14 } 14 }
15 15
16 ComplexFeature::~ComplexFeature() { 16 ComplexFeature::~ComplexFeature() {
17 } 17 }
18 18
19 Feature::Availability ComplexFeature::IsAvailableToManifest( 19 Feature::Availability ComplexFeature::IsAvailableToManifest(
20 const std::string& extension_id, Extension::Type type, Location location, 20 const std::string& extension_id, Manifest::Type type, Location location,
21 int manifest_version, Platform platform) const { 21 int manifest_version, Platform platform) const {
22 Feature::Availability first_availability = 22 Feature::Availability first_availability =
23 features_[0]->IsAvailableToManifest( 23 features_[0]->IsAvailableToManifest(
24 extension_id, type, location, manifest_version, platform); 24 extension_id, type, location, manifest_version, platform);
25 if (first_availability.is_available()) 25 if (first_availability.is_available())
26 return first_availability; 26 return first_availability;
27 27
28 for (FeatureList::const_iterator it = features_.begin() + 1; 28 for (FeatureList::const_iterator it = features_.begin() + 1;
29 it != features_.end(); ++it) { 29 it != features_.end(); ++it) {
30 Availability availability = (*it)->IsAvailableToManifest( 30 Availability availability = (*it)->IsAvailableToManifest(
(...skipping 27 matching lines...) Expand all
58 58
59 std::set<Feature::Context>* ComplexFeature::GetContexts() { 59 std::set<Feature::Context>* ComplexFeature::GetContexts() {
60 // TODO(justinlin): Current use cases for ComplexFeatures are simple (e.g. 60 // TODO(justinlin): Current use cases for ComplexFeatures are simple (e.g.
61 // allow API in dev channel for everyone but stable channel for a whitelist), 61 // allow API in dev channel for everyone but stable channel for a whitelist),
62 // but if they get more complicated, we need to return some meaningful context 62 // but if they get more complicated, we need to return some meaningful context
63 // set. Either that or remove this method from the Feature interface. 63 // set. Either that or remove this method from the Feature interface.
64 return features_[0]->GetContexts(); 64 return features_[0]->GetContexts();
65 } 65 }
66 66
67 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, 67 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result,
68 Extension::Type type) const { 68 Manifest::Type type) const {
69 if (result == IS_AVAILABLE) 69 if (result == IS_AVAILABLE)
70 return ""; 70 return "";
71 71
72 // TODO(justinlin): Form some kind of combined availabilities/messages from 72 // TODO(justinlin): Form some kind of combined availabilities/messages from
73 // SimpleFeatures. 73 // SimpleFeatures.
74 return features_[0]->GetAvailabilityMessage(result, type); 74 return features_[0]->GetAvailabilityMessage(result, type);
75 } 75 }
76 76
77 } // namespace extensions 77 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/features/complex_feature.h ('k') | chrome/common/extensions/features/complex_feature_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698