summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/plain_text_controller.h
blob: 737b2751393f59eb36ce1a62e3ec0abe8152d88a (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
// Copyright (c) 2006-2009 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.

// PlainTextController class:
// Bound to a JavaScript window.plainText object using
// CppBoundClass::BindToJavascript(), this allows layout tests that are run in
// the test_shell to extract plain text from the DOM or the selection.
//
// The OSX reference file is in
// WebKit/WebKitTools/DumpRenderTree/PlainTextController.mm

#ifndef WEBKIT_TOOLS_TEST_SHELL_PLAIN_TEXT_CONTROLLER_H_
#define WEBKIT_TOOLS_TEST_SHELL_PLAIN_TEXT_CONTROLLER_H_

#include "build/build_config.h"
#include "webkit/glue/cpp_bound_class.h"

class TestShell;

class PlainTextController : public CppBoundClass {
 public:
  // Builds the property and method lists needed to bind this class to a JS
  // object.
  explicit PlainTextController(TestShell* shell);

  // JS callback methods.
  void plainText(const CppArgumentList& args, CppVariant* result);

  // Fall-back method: called if an unknown method is invoked.
  void fallbackMethod(const CppArgumentList& args, CppVariant* result);

 private:
  // Non-owning pointer.  The LayoutTestController is owned by the host.
  static TestShell* shell_;
};

#endif  // WEBKIT_TOOLS_TEST_SHELL_PLAIN_TEXT_CONTROLLER_H_