summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/incognito_handler.h
blob: b9eadee9e2e5c2ddfee253fdedceca3cd8ac16bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_COMMON_EXTENSIONS_INCOGNITO_HANDLER_H_
#define CHROME_COMMON_EXTENSIONS_INCOGNITO_HANDLER_H_

#include "base/strings/string16.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/manifest_handler.h"

namespace extensions {

struct IncognitoInfo : public Extension::ManifestData {
  explicit IncognitoInfo(bool split_mode);
  virtual ~IncognitoInfo();

  // If true, a separate process will be used for the extension in incognito
  // mode.
  bool split_mode;

  // Return the incognito mode information for the given |extension|.
  static bool IsSplitMode(const Extension* extension);
};

// Parses the "incognito" manifest key.
class IncognitoHandler : public ManifestHandler {
 public:
  IncognitoHandler();
  virtual ~IncognitoHandler();

  virtual bool Parse(Extension* extension, string16* error) OVERRIDE;
  virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE;

 private:
  virtual const std::vector<std::string> Keys() const OVERRIDE;

  DISALLOW_COPY_AND_ASSIGN(IncognitoHandler);
};

}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_INCOGNITO_HANDLER_H_