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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 case IDC_SPELLCHECK_ADD_TO_DICTIONARY: | 221 case IDC_SPELLCHECK_ADD_TO_DICTIONARY: |
222 return !misspelled_word_.empty(); | 222 return !misspelled_word_.empty(); |
223 | 223 |
224 case IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS: | 224 case IDC_CONTENT_CONTEXT_NO_SPELLING_SUGGESTIONS: |
225 return false; | 225 return false; |
226 | 226 |
227 case IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION: | 227 case IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION: |
228 return succeeded_; | 228 return succeeded_; |
229 | 229 |
230 case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE: | 230 case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE: |
231 return integrate_spelling_service_.IsUserModifiable() && | |
232 !profile->IsOffTheRecord(); | |
233 | |
234 case IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE: | 231 case IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE: |
235 return integrate_spelling_service_.IsUserModifiable() && | 232 return integrate_spelling_service_.IsUserModifiable() && |
236 !profile->IsOffTheRecord(); | 233 !profile->IsOffTheRecord(); |
237 | 234 |
238 default: | 235 default: |
239 return false; | 236 return false; |
240 } | 237 } |
241 } | 238 } |
242 | 239 |
243 void SpellingMenuObserver::ExecuteCommand(int command_id) { | 240 void SpellingMenuObserver::ExecuteCommand(int command_id) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // Append '.' characters to the end of "Checking". | 400 // Append '.' characters to the end of "Checking". |
404 loading_frame_ = (loading_frame_ + 1) & 3; | 401 loading_frame_ = (loading_frame_ + 1) & 3; |
405 base::string16 loading_message = | 402 base::string16 loading_message = |
406 loading_message_ + base::string16(loading_frame_,'.'); | 403 loading_message_ + base::string16(loading_frame_,'.'); |
407 | 404 |
408 // Update the menu item with the text. We disable this item to prevent users | 405 // Update the menu item with the text. We disable this item to prevent users |
409 // from selecting it. | 406 // from selecting it. |
410 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 407 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
411 loading_message); | 408 loading_message); |
412 } | 409 } |
OLD | NEW |