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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 // If word is misspelled, give option for "Add to dictionary" and a check item | 166 // If word is misspelled, give option for "Add to dictionary" and a check item |
167 // "Ask Google for suggestions". | 167 // "Ask Google for suggestions". |
168 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY, | 168 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY, |
169 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY)); | 169 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY)); |
170 | 170 |
171 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, | 171 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE, |
172 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); | 172 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE)); |
173 | 173 |
174 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 174 const base::CommandLine* command_line = |
| 175 base::CommandLine::ForCurrentProcess(); |
175 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { | 176 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { |
176 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, | 177 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, |
177 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); | 178 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); |
178 } | 179 } |
179 | 180 |
180 proxy_->AddSeparator(); | 181 proxy_->AddSeparator(); |
181 } | 182 } |
182 | 183 |
183 bool SpellingMenuObserver::IsCommandIdSupported(int command_id) { | 184 bool SpellingMenuObserver::IsCommandIdSupported(int command_id) { |
184 if (command_id >= IDC_SPELLCHECK_SUGGESTION_0 && | 185 if (command_id >= IDC_SPELLCHECK_SUGGESTION_0 && |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // Append '.' characters to the end of "Checking". | 404 // Append '.' characters to the end of "Checking". |
404 loading_frame_ = (loading_frame_ + 1) & 3; | 405 loading_frame_ = (loading_frame_ + 1) & 3; |
405 base::string16 loading_message = | 406 base::string16 loading_message = |
406 loading_message_ + base::string16(loading_frame_,'.'); | 407 loading_message_ + base::string16(loading_frame_,'.'); |
407 | 408 |
408 // Update the menu item with the text. We disable this item to prevent users | 409 // Update the menu item with the text. We disable this item to prevent users |
409 // from selecting it. | 410 // from selecting it. |
410 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 411 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
411 loading_message); | 412 loading_message); |
412 } | 413 } |
OLD | NEW |