]> khamidou — GitHub mirrors - electron.git/commitdiff
Add an empty SpellCheckClient
authorCheng Zhao <zcbenz@gmail.com>
Thu, 18 Dec 2014 21:43:51 +0000 (13:43 -0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 18 Dec 2014 21:43:51 +0000 (13:43 -0800)
atom.gyp
atom/renderer/api/atom_api_spell_check_client.cc [new file with mode: 0644]
atom/renderer/api/atom_api_spell_check_client.h [new file with mode: 0644]

index b4cd71c4398e21a1d8753c3bd23026cf2b2459de..17c1b60a111eb3e5d3bde975a10558fb81ac7c64 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       'atom/common/platform_util_mac.mm',
       'atom/common/platform_util_win.cc',
       'atom/renderer/api/atom_api_renderer_ipc.cc',
-      'atom/renderer/api/atom_renderer_bindings.cc',
-      'atom/renderer/api/atom_renderer_bindings.h',
+      'atom/renderer/api/atom_api_spell_check_client.cc',
+      'atom/renderer/api/atom_api_spell_check_client.h',
       'atom/renderer/api/atom_api_web_frame.cc',
       'atom/renderer/api/atom_api_web_frame.h',
+      'atom/renderer/api/atom_renderer_bindings.cc',
+      'atom/renderer/api/atom_renderer_bindings.h',
       'atom/renderer/atom_render_view_observer.cc',
       'atom/renderer/atom_render_view_observer.h',
       'atom/renderer/atom_renderer_client.cc',
diff --git a/atom/renderer/api/atom_api_spell_check_client.cc b/atom/renderer/api/atom_api_spell_check_client.cc
new file mode 100644 (file)
index 0000000..ad43ee9
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (c) 2014 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#include "atom/renderer/api/atom_api_spell_check_client.h"
+
+namespace atom {
+
+namespace api {
+
+SpellCheckClient::SpellCheckClient(v8::Isolate* isolate,
+                                   v8::Local<v8::Object> provider)
+    : provider_(isolate, provider) {}
+
+SpellCheckClient::~SpellCheckClient() {}
+
+void SpellCheckClient::spellCheck(
+    const blink::WebString& text,
+    int& misspelledOffset,
+    int& misspelledLength,
+    blink::WebVector<blink::WebString>* optionalSuggestions) {
+}
+
+void SpellCheckClient::checkTextOfParagraph(
+    const blink::WebString&,
+    blink::WebTextCheckingTypeMask mask,
+    blink::WebVector<blink::WebTextCheckingResult>* results) {
+}
+
+void SpellCheckClient::requestCheckingOfText(
+    const blink::WebString& textToCheck,
+    const blink::WebVector<uint32_t>& markersInText,
+    const blink::WebVector<unsigned>& markerOffsets,
+    blink::WebTextCheckingCompletion* completionCallback) {
+}
+
+blink::WebString SpellCheckClient::autoCorrectWord(
+    const blink::WebString& misspelledWord) {
+  return blink::WebString();
+}
+
+void SpellCheckClient::showSpellingUI(bool show) {
+}
+
+bool SpellCheckClient::isShowingSpellingUI() {
+  return false;
+}
+
+void SpellCheckClient::updateSpellingUIWithMisspelledWord(
+    const blink::WebString& word) {
+}
+
+}  // namespace api
+
+}  // namespace atom
diff --git a/atom/renderer/api/atom_api_spell_check_client.h b/atom/renderer/api/atom_api_spell_check_client.h
new file mode 100644 (file)
index 0000000..759baaf
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (c) 2014 GitHub, Inc.
+// Use of this source code is governed by the MIT license that can be
+// found in the LICENSE file.
+
+#ifndef ATOM_RENDERER_API_ATOM_API_SPELL_CHECK_CLIENT_H_
+#define ATOM_RENDERER_API_ATOM_API_SPELL_CHECK_CLIENT_H_
+
+#include "native_mate/scoped_persistent.h"
+#include "third_party/WebKit/public/web/WebSpellCheckClient.h"
+
+namespace atom {
+
+namespace api {
+
+class SpellCheckClient : public blink::WebSpellCheckClient {
+ public:
+  SpellCheckClient(v8::Isolate* isolate, v8::Local<v8::Object> provider);
+  virtual ~SpellCheckClient();
+
+ private:
+  // blink::WebSpellCheckClient:
+  void spellCheck(
+      const blink::WebString& text,
+      int& misspelledOffset,
+      int& misspelledLength,
+      blink::WebVector<blink::WebString>* optionalSuggestions) override;
+  void checkTextOfParagraph(
+      const blink::WebString&,
+      blink::WebTextCheckingTypeMask mask,
+      blink::WebVector<blink::WebTextCheckingResult>* results) override;
+  void requestCheckingOfText(
+      const blink::WebString& textToCheck,
+      const blink::WebVector<uint32_t>& markersInText,
+      const blink::WebVector<unsigned>& markerOffsets,
+      blink::WebTextCheckingCompletion* completionCallback) override;
+  blink::WebString autoCorrectWord(
+      const blink::WebString& misspelledWord) override;
+  void showSpellingUI(bool show) override;
+  bool isShowingSpellingUI() override;
+  void updateSpellingUIWithMisspelledWord(
+      const blink::WebString& word) override;
+
+  mate::ScopedPersistent<v8::Object> provider_;
+
+  DISALLOW_COPY_AND_ASSIGN(SpellCheckClient);
+};
+
+}  // namespace api
+
+}  // namespace atom
+
+#endif  // ATOM_RENDERER_API_ATOM_API_SPELL_CHECK_CLIENT_H_