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

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

Issue 25305002: Implement initial chrome.browserAction.openPopup API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to interactive_ui_test Created 7 years, 2 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/common/extensions/features/complex_feature.h" 5 #include "chrome/common/extensions/features/complex_feature.h"
6 6
7 namespace extensions { 7 namespace extensions {
8 8
9 ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) { 9 ComplexFeature::ComplexFeature(scoped_ptr<FeatureList> features) {
10 DCHECK_GT(features->size(), 0UL); 10 DCHECK_GT(features->size(), 0UL);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 std::set<Feature::Context>* ComplexFeature::GetContexts() { 60 std::set<Feature::Context>* ComplexFeature::GetContexts() {
61 // TODO(justinlin): Current use cases for ComplexFeatures are simple (e.g. 61 // TODO(justinlin): Current use cases for ComplexFeatures are simple (e.g.
62 // allow API in dev channel for everyone but stable channel for a whitelist), 62 // allow API in dev channel for everyone but stable channel for a whitelist),
63 // but if they get more complicated, we need to return some meaningful context 63 // but if they get more complicated, we need to return some meaningful context
64 // set. Either that or remove this method from the Feature interface. 64 // set. Either that or remove this method from the Feature interface.
65 return features_[0]->GetContexts(); 65 return features_[0]->GetContexts();
66 } 66 }
67 67
68 bool ComplexFeature::IsInternal() const { 68 bool ComplexFeature::IsInternal() const {
69 NOTREACHED(); 69 // TODO(justinlin): Same as the above TODO.
70 return false; 70 return features_[0]->IsInternal();
71 } 71 }
72 72
73 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result, 73 std::string ComplexFeature::GetAvailabilityMessage(AvailabilityResult result,
74 Manifest::Type type, 74 Manifest::Type type,
75 const GURL& url, 75 const GURL& url,
76 Context context) const { 76 Context context) const {
77 if (result == IS_AVAILABLE) 77 if (result == IS_AVAILABLE)
78 return std::string(); 78 return std::string();
79 79
80 // TODO(justinlin): Form some kind of combined availabilities/messages from 80 // TODO(justinlin): Form some kind of combined availabilities/messages from
81 // SimpleFeatures. 81 // SimpleFeatures.
82 return features_[0]->GetAvailabilityMessage(result, type, url, context); 82 return features_[0]->GetAvailabilityMessage(result, type, url, context);
83 } 83 }
84 84
85 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const { 85 bool ComplexFeature::IsIdInWhitelist(const std::string& extension_id) const {
86 for (FeatureList::const_iterator it = features_.begin(); 86 for (FeatureList::const_iterator it = features_.begin();
87 it != features_.end(); ++it) { 87 it != features_.end(); ++it) {
88 if ((*it)->IsIdInWhitelist(extension_id)) 88 if ((*it)->IsIdInWhitelist(extension_id))
89 return true; 89 return true;
90 } 90 }
91 return false; 91 return false;
92 } 92 }
93 93
94 } // namespace extensions 94 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698