summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/searchbox/searchbox_extension.h
blob: 51fb15b8d6e0326a87b020125eae0414e661f6d1 (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
// Copyright 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_RENDERER_SEARCHBOX_SEARCHBOX_EXTENSION_H_
#define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_EXTENSION_H_

#include "base/basictypes.h"

namespace v8 {
class Extension;
}

namespace WebKit {
class WebFrame;
}

namespace extensions_v8 {

// Reference implementation of the SearchBox API as described in:
// http://dev.chromium.org/searchbox
class SearchBoxExtension {
 public:
  // Returns the v8::Extension object handling searchbox bindings. Returns null
  // if match-preview is not enabled. Caller takes ownership of returned object.
  static v8::Extension* Get();

  static void DispatchChange(WebKit::WebFrame* frame);
  static void DispatchSubmit(WebKit::WebFrame* frame);
  static void DispatchCancel(WebKit::WebFrame* frame);
  static void DispatchResize(WebKit::WebFrame* frame);

  static bool PageSupportsInstant(WebKit::WebFrame* frame);

  // Extended API.
  static void DispatchOnWindowReady(WebKit::WebFrame* frame);
  static void DispatchAutocompleteResults(WebKit::WebFrame* frame);
  static void DispatchUpOrDownKeyPress(WebKit::WebFrame* frame, int count);
  static void DispatchKeyCaptureChange(WebKit::WebFrame* frame);
  static void DispatchFocus(WebKit::WebFrame* frame);
  static void DispatchBlur(WebKit::WebFrame* frame);
  static void DispatchContextChange(WebKit::WebFrame* frame);
  static void DispatchThemeChange(WebKit::WebFrame* frame);
  static void DispatchThemeAreaHeightChange(WebKit::WebFrame* frame);

 private:
  DISALLOW_IMPLICIT_CONSTRUCTORS(SearchBoxExtension);
};

}  // namespace extensions_v8

#endif  // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_EXTENSION_H_