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

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

Issue 2591073002: Simplify context menu for misspelled words + add metrics to this context (Closed)
Patch Set: Merge Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer_context_menu/spelling_menu_observer.h" 5 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 spellcheck_service->GetMetrics()->RecordSuggestionStats(1); 162 spellcheck_service->GetMetrics()->RecordSuggestionStats(1);
163 proxy_->AddSeparator(); 163 proxy_->AddSeparator();
164 } 164 }
165 165
166 // If word is misspelled, give option for "Add to dictionary" and, if 166 // If word is misspelled, give option for "Add to dictionary" and, if
167 // multilingual spellchecking is not enabled, a check item "Ask Google for 167 // multilingual spellchecking is not enabled, a check item "Ask Google for
168 // suggestions". 168 // suggestions".
169 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY, 169 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY,
170 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY)); 170 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY));
171 proxy_->AddSpellCheckServiceItem(integrate_spelling_service_.GetValue()); 171 proxy_->AddSpellCheckServiceItem(integrate_spelling_service_.GetValue());
172 proxy_->AddSeparator();
173 } 172 }
174 173
175 bool SpellingMenuObserver::IsCommandIdSupported(int command_id) { 174 bool SpellingMenuObserver::IsCommandIdSupported(int command_id) {
176 if (command_id >= IDC_SPELLCHECK_SUGGESTION_0 && 175 if (command_id >= IDC_SPELLCHECK_SUGGESTION_0 &&
177 command_id <= IDC_SPELLCHECK_SUGGESTION_LAST) 176 command_id <= IDC_SPELLCHECK_SUGGESTION_LAST)
178 return true; 177 return true;
179 178
180 switch (command_id) { 179 switch (command_id) {
181 case IDC_SPELLCHECK_ADD_TO_DICTIONARY: 180 case IDC_SPELLCHECK_ADD_TO_DICTIONARY:
182 case IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS: 181 case IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS:
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Append '.' characters to the end of "Checking". 360 // Append '.' characters to the end of "Checking".
362 loading_frame_ = (loading_frame_ + 1) & 3; 361 loading_frame_ = (loading_frame_ + 1) & 3;
363 base::string16 loading_message = 362 base::string16 loading_message =
364 loading_message_ + base::string16(loading_frame_,'.'); 363 loading_message_ + base::string16(loading_frame_,'.');
365 364
366 // Update the menu item with the text. We disable this item to prevent users 365 // Update the menu item with the text. We disable this item to prevent users
367 // from selecting it. 366 // from selecting it.
368 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, 367 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false,
369 loading_message); 368 loading_message);
370 } 369 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698