summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/input_ime/input_components_handler.h
blob: 215f2f15a25650c414a24fccdb3d9abb4997f2d8 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2012 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_API_INPUT_IME_INPUT_COMPONENTS_HANDLER_H_
#define CHROME_COMMON_EXTENSIONS_API_INPUT_IME_INPUT_COMPONENTS_HANDLER_H_

#include <set>
#include <string>
#include <vector>

#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/manifest_handler.h"

namespace extensions {

class Extension;

enum InputComponentType {
  INPUT_COMPONENT_TYPE_NONE = -1,
  INPUT_COMPONENT_TYPE_IME,
  INPUT_COMPONENT_TYPE_COUNT
};

struct InputComponentInfo {
  // Define out of line constructor/destructor to please Clang.
  InputComponentInfo();
  ~InputComponentInfo();

  std::string name;
  InputComponentType type;
  std::string id;
  std::string description;
  std::string language;
  std::set<std::string> layouts;
  std::string shortcut_keycode;
  bool shortcut_alt;
  bool shortcut_ctrl;
  bool shortcut_shift;
};

struct InputComponents : public Extension::ManifestData {
  // Define out of line constructor/destructor to please Clang.
  InputComponents();
  virtual ~InputComponents();

  std::vector<InputComponentInfo> input_components;

  // Returns list of input components and associated properties.
  static const std::vector<InputComponentInfo>* GetInputComponents(
      const Extension* extension);
};

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

  virtual bool Parse(Extension* extension, string16* error) OVERRIDE;

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

  DISALLOW_COPY_AND_ASSIGN(InputComponentsHandler);
};

}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_API_INPUT_IME_INPUT_COMPONENTS_HANDLER_H_