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

Side by Side Diff: extensions/common/features/manifest_feature.cc

Issue 2241203003: Pass user session type to extension feature checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split out some stuff Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/common/features/manifest_feature.h" 5 #include "extensions/common/features/manifest_feature.h"
6 6
7 #include "extensions/common/manifest.h" 7 #include "extensions/common/manifest.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 ManifestFeature::ManifestFeature() { 11 ManifestFeature::ManifestFeature() {
12 } 12 }
13 13
14 ManifestFeature::~ManifestFeature() { 14 ManifestFeature::~ManifestFeature() {
15 } 15 }
16 16
17 Feature::Availability ManifestFeature::IsAvailableToContext( 17 Feature::Availability ManifestFeature::IsAvailableToContext(
18 const Extension* extension, 18 const Extension* extension,
19 Feature::Context context, 19 Feature::Context context,
20 Feature::SessionType session_type,
20 const GURL& url, 21 const GURL& url,
21 Feature::Platform platform) const { 22 Feature::Platform platform) const {
22 Availability availability = SimpleFeature::IsAvailableToContext(extension, 23 Availability availability = SimpleFeature::IsAvailableToContext(
23 context, 24 extension, context, session_type, url, platform);
24 url,
25 platform);
26 if (!availability.is_available()) 25 if (!availability.is_available())
27 return availability; 26 return availability;
28 27
29 // We know we can skip manifest()->GetKey() here because we just did the same 28 // We know we can skip manifest()->GetKey() here because we just did the same
30 // validation it would do above. 29 // validation it would do above.
31 if (extension && !extension->manifest()->value()->HasKey(name())) 30 if (extension && !extension->manifest()->value()->HasKey(name()))
32 return CreateAvailability(NOT_PRESENT, extension->GetType()); 31 return CreateAvailability(NOT_PRESENT, extension->GetType());
33 32
34 return CreateAvailability(IS_AVAILABLE); 33 return CreateAvailability(IS_AVAILABLE);
35 } 34 }
(...skipping 10 matching lines...) Expand all
46 45
47 if (!contexts().empty()) { 46 if (!contexts().empty()) {
48 *error = name() + ": Manifest features do not support contexts."; 47 *error = name() + ": Manifest features do not support contexts.";
49 return false; 48 return false;
50 } 49 }
51 50
52 return true; 51 return true;
53 } 52 }
54 53
55 } // namespace extensions 54 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698