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

Unified Diff: chrome/renderer/spellchecker/spellcheck_provider.cc

Issue 11308339: [Spellcheck] Added UMA metrics for WebKit API usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to HEAD Created 8 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/spellchecker/spellcheck_provider.cc
diff --git a/chrome/renderer/spellchecker/spellcheck_provider.cc b/chrome/renderer/spellchecker/spellcheck_provider.cc
index c71e415adff3f91635fbe1320b5c25b39c2dfecb..de268a9f43dfd142c74aea0124a0edb70bade447 100644
--- a/chrome/renderer/spellchecker/spellcheck_provider.cc
+++ b/chrome/renderer/spellchecker/spellcheck_provider.cc
@@ -5,6 +5,7 @@
#include "chrome/renderer/spellchecker/spellcheck_provider.h"
#include "base/command_line.h"
+#include "base/metrics/histogram.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/spellcheck_messages.h"
#include "chrome/common/spellcheck_result.h"
@@ -144,9 +145,10 @@ void SpellCheckProvider::spellCheck(
spellcheck_->SpellCheckWord(
word.c_str(), word.size(), routing_id(),
&offset, &length, optional_suggestions ? & suggestions : NULL);
- if (optional_suggestions)
- *optional_suggestions = suggestions;
- if (!optional_suggestions) {
+ if (optional_suggestions) {
+ UMA_HISTOGRAM_COUNTS("SpellCheck.api.check.suggestions", word.size());
+ } else {
+ UMA_HISTOGRAM_COUNTS("SpellCheck.api.check", word.size());
// If optional_suggestions is not requested, the API is called
// for marking. So we use this for counting markable words.
Send(new SpellCheckHostMsg_NotifyChecked(routing_id(), word, 0 < length));
@@ -167,6 +169,7 @@ void SpellCheckProvider::checkTextOfParagraph(
return;
spellcheck_->SpellCheckParagraph(string16(text), results);
+ UMA_HISTOGRAM_COUNTS("SpellCheck.api.paragraph", text.length());
#endif
}
@@ -174,17 +177,21 @@ void SpellCheckProvider::requestCheckingOfText(
const WebString& text,
WebTextCheckingCompletion* completion) {
RequestTextChecking(text, completion);
+ UMA_HISTOGRAM_COUNTS("SpellCheck.api.async", text.length());
}
WebString SpellCheckProvider::autoCorrectWord(const WebString& word) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kEnableSpellingAutoCorrect))
+ if (command_line.HasSwitch(switches::kEnableSpellingAutoCorrect)) {
+ UMA_HISTOGRAM_COUNTS("SpellCheck.api.autocorrect", word.length());
return spellcheck_->GetAutoCorrectionWord(word, routing_id());
+ }
return string16();
}
void SpellCheckProvider::showSpellingUI(bool show) {
#if defined(OS_MACOSX)
+ UMA_HISTOGRAM_BOOLEAN("SpellCheck.api.showUI", show);
Send(new SpellCheckHostMsg_ShowSpellingPanel(routing_id(), show));
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698