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

Side by Side Diff: chrome/browser/tab_contents/spelling_menu_observer.cc

Issue 9368052: Removed WebTextCheckingResult legacy API use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated to ToT. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/tab_contents/spelling_menu_observer.h" 5 #include "chrome/browser/tab_contents/spelling_menu_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // suggested words. If the replaced text is included in the suggestion list 247 // suggested words. If the replaced text is included in the suggestion list
248 // provided by the local spellchecker, we show a "No suggestions from Google" 248 // provided by the local spellchecker, we show a "No suggestions from Google"
249 // message. 249 // message.
250 succeeded_ = true; 250 succeeded_ = true;
251 if (results.empty()) { 251 if (results.empty()) {
252 succeeded_ = false; 252 succeeded_ = false;
253 } else { 253 } else {
254 typedef std::vector<WebKit::WebTextCheckingResult> WebTextCheckingResults; 254 typedef std::vector<WebKit::WebTextCheckingResult> WebTextCheckingResults;
255 for (WebTextCheckingResults::const_iterator it = results.begin(); 255 for (WebTextCheckingResults::const_iterator it = results.begin();
256 it != results.end(); ++it) { 256 it != results.end(); ++it) {
257 result_.replace(it->position, it->length, it->replacement); 257 result_.replace(it->location, it->length, it->replacement);
258 } 258 }
259 for (std::vector<string16>::const_iterator it = suggestions_.begin(); 259 for (std::vector<string16>::const_iterator it = suggestions_.begin();
260 it != suggestions_.end(); ++it) { 260 it != suggestions_.end(); ++it) {
261 if (result_ == *it) { 261 if (result_ == *it) {
262 succeeded_ = false; 262 succeeded_ = false;
263 break; 263 break;
264 } 264 }
265 } 265 }
266 } 266 }
267 if (!succeeded_) { 267 if (!succeeded_) {
(...skipping 12 matching lines...) Expand all
280 loading_frame_ = (loading_frame_ + 1) & 3; 280 loading_frame_ = (loading_frame_ + 1) & 3;
281 string16 loading_message = loading_message_; 281 string16 loading_message = loading_message_;
282 for (int i = 0; i < loading_frame_; ++i) 282 for (int i = 0; i < loading_frame_; ++i)
283 loading_message.push_back('.'); 283 loading_message.push_back('.');
284 284
285 // Update the menu item with the text. We disable this item to prevent users 285 // Update the menu item with the text. We disable this item to prevent users
286 // from selecting it. 286 // from selecting it.
287 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, 287 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false,
288 loading_message); 288 loading_message);
289 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698