| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |