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

Unified Diff: chrome/browser/spellchecker/misspelling.h

Issue 1006953003: Revert "Remove spellcheck feedback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « chrome/browser/spellchecker/feedback_unittest.cc ('k') | chrome/browser/spellchecker/misspelling.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellchecker/misspelling.h
diff --git a/chrome/browser/spellchecker/misspelling.h b/chrome/browser/spellchecker/misspelling.h
new file mode 100644
index 0000000000000000000000000000000000000000..7db83f708ce8f8a542fca5c9e7458234b2476edf
--- /dev/null
+++ b/chrome/browser/spellchecker/misspelling.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2013 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.
+//
+// An object to store user feedback to a single spellcheck suggestion.
+//
+// Stores the spellcheck suggestion, its uint32 hash identifier, and user's
+// feedback. The feedback is indirect, in the sense that we record user's
+// |action| instead of asking them how they feel about a spellcheck suggestion.
+// The object can serialize itself.
+
+#ifndef CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_
+#define CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_
+
+#include <vector>
+
+#include "base/time/time.h"
+#include "chrome/browser/spellchecker/spellcheck_action.h"
+
+// Stores user feedback to a spellcheck suggestion. Sample usage:
+// Misspelling misspelling.
+// misspelling.context = base::ASCIIToUTF16("Helllo world");
+// misspelling.location = 0;
+// misspelling.length = 6;
+// misspelling.suggestions =
+// std::vector<base::string16>(1, base::ASCIIToUTF16("Hello"));
+// misspelling.hash = GenerateRandomHash();
+// misspelling.action.type = SpellcheckAction::TYPE_SELECT;
+// misspelling.action.index = 0;
+// Process(misspelling.Serialize());
+class Misspelling {
+ public:
+ Misspelling();
+ Misspelling(const base::string16& context,
+ size_t location,
+ size_t length,
+ const std::vector<base::string16>& suggestions,
+ uint32 hash);
+ ~Misspelling();
+
+ // Serializes the data in this object into a dictionary value. The caller owns
+ // the result.
+ base::DictionaryValue* Serialize() const;
+
+ // Returns the substring of |context| that begins at |location| and contains
+ // |length| characters.
+ base::string16 GetMisspelledString() const;
+
+ // A several-word text snippet that immediately surrounds the misspelling.
+ base::string16 context;
+
+ // The number of characters between the beginning of |context| and the first
+ // misspelled character.
+ size_t location;
+
+ // The number of characters in the misspelling.
+ size_t length;
+
+ // Spelling suggestions.
+ std::vector<base::string16> suggestions;
+
+ // The hash that identifies the misspelling.
+ uint32 hash;
+
+ // User action.
+ SpellcheckAction action;
+
+ // The time when the user applied the action.
+ base::Time timestamp;
+};
+
+#endif // CHROME_BROWSER_SPELLCHECKER_MISSPELLING_H_
« no previous file with comments | « chrome/browser/spellchecker/feedback_unittest.cc ('k') | chrome/browser/spellchecker/misspelling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698