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

Unified Diff: chrome/common/spellcheck_result.h

Issue 9368052: Removed WebTextCheckingResult legacy API use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a build break on Mac. Created 8 years, 10 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: chrome/common/spellcheck_result.h
diff --git a/chrome/common/spellcheck_result.h b/chrome/common/spellcheck_result.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a03f6772ea742beb059fef2ead0835ddeb84f64
--- /dev/null
+++ b/chrome/common/spellcheck_result.h
@@ -0,0 +1,72 @@
+// 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_SPELLCHECK_RESULT_H_
+#define CHROME_COMMON_SPELLCHECK_RESULT_H_
+#pragma once
+
+#include "base/string16.h"
+#include "ipc/ipc_message_utils.h"
+
+// This class mirrors WebKit::WebTextCheckingResult which holds a
+// misspelled range inside the checked text. It also contains a
+// possible replacement of the misspelling if it is available.
+//
+// Although SpellCheckResult::Type defines various values Chromium
+// only uses the |Spelling| type. otehr values are just reflecting the
+// enum definition in the original WebKit class.
+//
+struct SpellCheckResult {
darin (slow to review) 2012/02/16 04:59:28 Do we care that "spell check result" can express m
+ enum Type {
+ Spelling = 1 << 1,
darin (slow to review) 2012/02/16 04:59:28 nit: use google c++ style.
+ Grammar = 1 << 2,
+ Link = 1 << 5,
+ Quote = 1 << 6,
+ Dash = 1 << 7,
+ Replacement = 1 << 8,
+ Correction = 1 << 9,
+ ShowCorrectionPanel = 1 << 10
+ };
+
+ explicit SpellCheckResult(
+ Type type = Spelling,
+ int location = 0,
+ int length = 0,
+ const string16& replacement = string16())
+ : type_(type),
+ location_(location),
+ length_(length),
+ replacement_(replacement) {
+ }
+
+ Type type() const { return type_; }
+ int location() const { return location_; }
+ int length() const { return length_; }
+ string16 replacement() const { return replacement_; }
+
+ // Puts these members public to make IPC serialization macros available.
+ Type type_;
darin (slow to review) 2012/02/16 04:59:28 nit: I recommend just eliminating the accessor fun
+ int location_;
+ int length_;
+ string16 replacement_;
+};
+
+namespace IPC {
+
+template <>
darin (slow to review) 2012/02/16 04:59:28 usually, IPC traits go into a separate header file
+struct SimilarTypeTraits<SpellCheckResult::Type> {
+ typedef int Type;
+};
+
+template <>
+struct ParamTraits<SpellCheckResult> {
+ typedef SpellCheckResult param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+} // namespace IPC
+
+#endif // CHROME_COMMON_SPELLCHECK_RESULT_H_

Powered by Google App Engine
This is Rietveld 408576698