Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/spellchecker/spellcheck_provider.h" | 5 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/renderer/spellchecker/spellcheck.h" | 10 #include "chrome/renderer/spellchecker/spellcheck.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 WebTextCheckingCompletion* completion) { | 168 WebTextCheckingCompletion* completion) { |
| 169 std::vector<SpellCheckMarker> spellcheck_markers; | 169 std::vector<SpellCheckMarker> spellcheck_markers; |
| 170 for (size_t i = 0; i < markers.size(); ++i) { | 170 for (size_t i = 0; i < markers.size(); ++i) { |
| 171 spellcheck_markers.push_back( | 171 spellcheck_markers.push_back( |
| 172 SpellCheckMarker(markers[i], marker_offsets[i])); | 172 SpellCheckMarker(markers[i], marker_offsets[i])); |
| 173 } | 173 } |
| 174 RequestTextChecking(text, completion, spellcheck_markers); | 174 RequestTextChecking(text, completion, spellcheck_markers); |
| 175 UMA_HISTOGRAM_COUNTS("SpellCheck.api.async", text.length()); | 175 UMA_HISTOGRAM_COUNTS("SpellCheck.api.async", text.length()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void SpellCheckProvider::prepareForLeakDetection() { | |
|
please use gerrit instead
2016/08/09 16:47:57
Let's use a name that better describes what happen
Xiaocheng
2016/08/10 01:14:47
Renamed to "cancelAllPendingRequests", which sound
| |
| 179 for (WebTextCheckCompletions::iterator iter(&text_check_completions_); | |
| 180 !iter.IsAtEnd(); iter.Advance()) | |
| 181 iter.GetCurrentValue()->didCancelCheckingText(); | |
| 182 text_check_completions_.Clear(); | |
| 183 } | |
| 184 | |
| 178 void SpellCheckProvider::showSpellingUI(bool show) { | 185 void SpellCheckProvider::showSpellingUI(bool show) { |
| 179 #if defined(USE_BROWSER_SPELLCHECKER) | 186 #if defined(USE_BROWSER_SPELLCHECKER) |
| 180 UMA_HISTOGRAM_BOOLEAN("SpellCheck.api.showUI", show); | 187 UMA_HISTOGRAM_BOOLEAN("SpellCheck.api.showUI", show); |
| 181 Send(new SpellCheckHostMsg_ShowSpellingPanel(routing_id(), show)); | 188 Send(new SpellCheckHostMsg_ShowSpellingPanel(routing_id(), show)); |
| 182 #endif | 189 #endif |
| 183 } | 190 } |
| 184 | 191 |
| 185 bool SpellCheckProvider::isShowingSpellingUI() { | 192 bool SpellCheckProvider::isShowingSpellingUI() { |
| 186 return spelling_panel_visible_; | 193 return spelling_panel_visible_; |
| 187 } | 194 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 return true; | 358 return true; |
| 352 } | 359 } |
| 353 } | 360 } |
| 354 | 361 |
| 355 return false; | 362 return false; |
| 356 } | 363 } |
| 357 | 364 |
| 358 void SpellCheckProvider::OnDestruct() { | 365 void SpellCheckProvider::OnDestruct() { |
| 359 delete this; | 366 delete this; |
| 360 } | 367 } |
| OLD | NEW |