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

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

Issue 2280113002: [SpellCheck] Add separator if we add "Add to dictionary" option (Closed)
Patch Set: Only add separator if there are suggestions above it Created 4 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 } 153 }
154 154
155 if (!params.dictionary_suggestions.empty()) { 155 if (!params.dictionary_suggestions.empty()) {
156 // |spellcheck_service| can be null when the suggested word is 156 // |spellcheck_service| can be null when the suggested word is
157 // provided by Web SpellCheck API. 157 // provided by Web SpellCheck API.
158 SpellcheckService* spellcheck_service = 158 SpellcheckService* spellcheck_service =
159 SpellcheckServiceFactory::GetForContext(browser_context); 159 SpellcheckServiceFactory::GetForContext(browser_context);
160 if (spellcheck_service && spellcheck_service->GetMetrics()) 160 if (spellcheck_service && spellcheck_service->GetMetrics())
161 spellcheck_service->GetMetrics()->RecordSuggestionStats(1); 161 spellcheck_service->GetMetrics()->RecordSuggestionStats(1);
162 proxy_->AddSeparator();
162 } 163 }
163 164
164 // If word is misspelled, give option for "Add to dictionary" and, if 165 // If word is misspelled, give option for "Add to dictionary" and, if
165 // multilingual spellchecking is not enabled, a check item "Ask Google for 166 // multilingual spellchecking is not enabled, a check item "Ask Google for
166 // suggestions". 167 // suggestions".
167 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY, 168 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY,
168 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY)); 169 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY));
169 proxy_->AddSpellCheckServiceItem(integrate_spelling_service_.GetValue()); 170 proxy_->AddSpellCheckServiceItem(integrate_spelling_service_.GetValue());
170 proxy_->AddSeparator(); 171 proxy_->AddSeparator();
171 } 172 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // Append '.' characters to the end of "Checking". 360 // Append '.' characters to the end of "Checking".
360 loading_frame_ = (loading_frame_ + 1) & 3; 361 loading_frame_ = (loading_frame_ + 1) & 3;
361 base::string16 loading_message = 362 base::string16 loading_message =
362 loading_message_ + base::string16(loading_frame_,'.'); 363 loading_message_ + base::string16(loading_frame_,'.');
363 364
364 // 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
365 // from selecting it. 366 // from selecting it.
366 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, 367 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false,
367 loading_message); 368 loading_message);
368 } 369 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698