Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: webkit/tools/test_shell/text_input_controller.cc

Issue 6296015: Remove eventSender, accessibilityController, plainText and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/webkit/tools/test_shell
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/tools/test_shell/text_input_controller.cc
diff --git a/webkit/tools/test_shell/text_input_controller.cc b/webkit/tools/test_shell/text_input_controller.cc
deleted file mode 100644
index 139f1a56b47514f5d69a39d5b020b17d96a7d9f6..0000000000000000000000000000000000000000
--- a/webkit/tools/test_shell/text_input_controller.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright (c) 2010 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.
-
-#include "webkit/tools/test_shell/text_input_controller.h"
-
-#include "base/string_util.h"
-#include "base/stringprintf.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-#include "webkit/tools/test_shell/test_shell.h"
-
-using WebKit::WebBindings;
-using WebKit::WebFrame;
-using WebKit::WebRange;
-using WebKit::WebRect;
-using WebKit::WebString;
-using WebKit::WebVector;
-
-TestShell* TextInputController::shell_ = NULL;
-
-TextInputController::TextInputController(TestShell* shell) {
- // Set static shell_ variable. Be careful not to assign shell_ to new
- // windows which are temporary.
- if (NULL == shell_)
- shell_ = shell;
-
- BindMethod("insertText", &TextInputController::insertText);
- BindMethod("doCommand", &TextInputController::doCommand);
- BindMethod("setMarkedText", &TextInputController::setMarkedText);
- BindMethod("unmarkText", &TextInputController::unmarkText);
- BindMethod("hasMarkedText", &TextInputController::hasMarkedText);
- BindMethod("conversationIdentifier", &TextInputController::conversationIdentifier);
- BindMethod("substringFromRange", &TextInputController::substringFromRange);
- BindMethod("attributedSubstringFromRange", &TextInputController::attributedSubstringFromRange);
- BindMethod("markedRange", &TextInputController::markedRange);
- BindMethod("selectedRange", &TextInputController::selectedRange);
- BindMethod("firstRectForCharacterRange", &TextInputController::firstRectForCharacterRange);
- BindMethod("characterIndexForPoint", &TextInputController::characterIndexForPoint);
- BindMethod("validAttributesForMarkedText", &TextInputController::validAttributesForMarkedText);
- BindMethod("makeAttributedString", &TextInputController::makeAttributedString);
-}
-
-// static
-WebFrame* TextInputController::GetMainFrame() {
- return shell_->webView()->mainFrame();
-}
-
-void TextInputController::insertText(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- if (args.size() >= 1 && args[0].isString()) {
- if (main_frame->hasMarkedText()) {
- main_frame->unmarkText();
- main_frame->replaceSelection(WebString());
- }
- main_frame->insertText(WebString::fromUTF8(args[0].ToString()));
- }
-}
-
-void TextInputController::doCommand(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- if (args.size() >= 1 && args[0].isString())
- main_frame->executeCommand(WebString::fromUTF8(args[0].ToString()));
-}
-
-void TextInputController::setMarkedText(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- if (args.size() >= 3 && args[0].isString()
- && args[1].isNumber() && args[2].isNumber()) {
- main_frame->setMarkedText(WebString::fromUTF8(args[0].ToString()),
- args[1].ToInt32(),
- args[2].ToInt32());
- }
-}
-
-void TextInputController::unmarkText(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- main_frame->unmarkText();
-}
-
-void TextInputController::hasMarkedText(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- result->Set(main_frame->hasMarkedText());
-}
-
-void TextInputController::conversationIdentifier(
- const CppArgumentList& args, CppVariant* result) {
- NOTIMPLEMENTED();
- result->SetNull();
-}
-
-void TextInputController::substringFromRange(
- const CppArgumentList& args, CppVariant* result) {
- NOTIMPLEMENTED();
- result->SetNull();
-}
-
-void TextInputController::attributedSubstringFromRange(
- const CppArgumentList& args, CppVariant* result) {
- NOTIMPLEMENTED();
- result->SetNull();
-}
-
-void TextInputController::markedRange(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- WebRange range = main_frame->markedRange();
-
- std::string range_str;
- base::SStringPrintf(&range_str, "%d,%d", range.startOffset(),
- range.endOffset());
- result->Set(range_str);
-}
-
-void TextInputController::selectedRange(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- WebRange range = main_frame->selectionRange();
-
- std::string range_str;
- base::SStringPrintf(&range_str, "%d,%d", range.startOffset(),
- range.endOffset());
- result->Set(range_str);
-}
-
-void TextInputController::firstRectForCharacterRange(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- if (args.size() < 2 || !args[0].isNumber() || !args[1].isNumber())
- return;
-
- WebRect rect;
- if (!main_frame->firstRectForCharacterRange(
- args[0].ToInt32(), args[1].ToInt32(), rect))
- return;
-
- WebVector<int> intArray(static_cast<size_t>(4));
- intArray[0] = rect.x;
- intArray[1] = rect.y;
- intArray[2] = rect.width;
- intArray[3] = rect.height;
- result->Set(WebBindings::makeIntArray(intArray));
-}
-
-void TextInputController::characterIndexForPoint(
- const CppArgumentList& args, CppVariant* result) {
- NOTIMPLEMENTED();
- result->SetNull();
-}
-
-void TextInputController::validAttributesForMarkedText(
- const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
-
- WebFrame* main_frame = GetMainFrame();
- if (!main_frame)
- return;
-
- result->Set("NSUnderline,NSUnderlineColor,NSMarkedClauseSegment,"
- "NSTextInputReplacementRangeAttributeName");
-}
-
-void TextInputController::makeAttributedString(
- const CppArgumentList& args, CppVariant* result) {
- NOTIMPLEMENTED();
- result->SetNull();
-}
« no previous file with comments | « webkit/tools/test_shell/text_input_controller.h ('k') | webkit/tools/test_shell/text_input_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698