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

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

Issue 22299009: Move channel-related (Chrome-specific) global state out of Feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/simple_feature.h" 5 #include "chrome/common/extensions/features/simple_feature.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/sha1.h" 12 #include "base/sha1.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/extensions/features/feature_channel.h"
17 18
18 using chrome::VersionInfo; 19 using chrome::VersionInfo;
19 20
20 namespace extensions { 21 namespace extensions {
21 22
22 namespace { 23 namespace {
23 24
24 struct Mappings { 25 struct Mappings {
25 Mappings() { 26 Mappings() {
26 extension_types["extension"] = Manifest::TYPE_EXTENSION; 27 extension_types["extension"] = Manifest::TYPE_EXTENSION;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 300
300 if (platform_ != UNSPECIFIED_PLATFORM && platform_ != platform) 301 if (platform_ != UNSPECIFIED_PLATFORM && platform_ != platform)
301 return CreateAvailability(INVALID_PLATFORM, type); 302 return CreateAvailability(INVALID_PLATFORM, type);
302 303
303 if (min_manifest_version_ != 0 && manifest_version < min_manifest_version_) 304 if (min_manifest_version_ != 0 && manifest_version < min_manifest_version_)
304 return CreateAvailability(INVALID_MIN_MANIFEST_VERSION, type); 305 return CreateAvailability(INVALID_MIN_MANIFEST_VERSION, type);
305 306
306 if (max_manifest_version_ != 0 && manifest_version > max_manifest_version_) 307 if (max_manifest_version_ != 0 && manifest_version > max_manifest_version_)
307 return CreateAvailability(INVALID_MAX_MANIFEST_VERSION, type); 308 return CreateAvailability(INVALID_MAX_MANIFEST_VERSION, type);
308 309
309 if (channel_has_been_set_ && channel_ < Feature::GetCurrentChannel()) 310 if (channel_has_been_set_ && channel_ < GetCurrentChannel())
310 return CreateAvailability(UNSUPPORTED_CHANNEL, type); 311 return CreateAvailability(UNSUPPORTED_CHANNEL, type);
311 312
312 return CreateAvailability(IS_AVAILABLE, type); 313 return CreateAvailability(IS_AVAILABLE, type);
313 } 314 }
314 315
315 Feature::Availability SimpleFeature::IsAvailableToContext( 316 Feature::Availability SimpleFeature::IsAvailableToContext(
316 const Extension* extension, 317 const Extension* extension,
317 SimpleFeature::Context context, 318 SimpleFeature::Context context,
318 const GURL& url, 319 const GURL& url,
319 SimpleFeature::Platform platform) const { 320 SimpleFeature::Platform platform) const {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return false; 451 return false;
451 452
452 if (whitelist_.find(extension_id) != whitelist_.end() || 453 if (whitelist_.find(extension_id) != whitelist_.end() ||
453 whitelist_.find(HashExtensionId(extension_id)) != whitelist_.end()) 454 whitelist_.find(HashExtensionId(extension_id)) != whitelist_.end())
454 return true; 455 return true;
455 456
456 return false; 457 return false;
457 } 458 }
458 459
459 } // namespace extensions 460 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/features/feature_channel.cc ('k') | chrome/common/extensions/features/simple_feature_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698