15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_EXTENSIONS_ADMIN_POLICY_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_EXTENSIONS_ADMIN_POLICY_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/values.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/common/extensions/extension.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace extensions {
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Extension;
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Functions for providing information about the extension whitelist,
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// blacklist, and forcelist imposed by admin policy.
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace extensions {
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace admin_policy {
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Checks if extensions are blacklisted by default, by policy. When true, this
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// means that even extensions without an ID should be blacklisted (e.g.
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// from the command line, or when loaded as an unpacked extension).
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool BlacklistedByDefault(const base::ListValue* blacklist);
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Returns true if the extension is allowed by the admin policy.
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool UserMayLoad(const base::ListValue* blacklist,
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                 const base::ListValue* whitelist,
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                 const base::DictionaryValue* forcelist,
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                 const base::ListValue* allowed_types,
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                 const Extension* extension,
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                 string16* error);
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns false if the extension is required to remain running. In practice
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// this enforces the admin policy forcelist.
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool UserMayModifySettings(const Extension* extension, string16* error);
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns false if the extension is required to remain running. In practice
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// this enforces the admin policy forcelist.
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)bool MustRemainEnabled(const Extension* extension, string16* error);
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_EXTENSIONS_ADMIN_POLICY_H_
45