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

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

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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 | Annotate | Revision Log
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 "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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 SpellcheckServiceFactory::GetForContext(profile); 158 SpellcheckServiceFactory::GetForContext(profile);
159 if (spellcheck_service && spellcheck_service->GetMetrics()) 159 if (spellcheck_service && spellcheck_service->GetMetrics())
160 spellcheck_service->GetMetrics()->RecordSuggestionStats(1); 160 spellcheck_service->GetMetrics()->RecordSuggestionStats(1);
161 } 161 }
162 162
163 // If word is misspelled, give option for "Add to dictionary" and a check item 163 // If word is misspelled, give option for "Add to dictionary" and a check item
164 // "Ask Google for suggestions". 164 // "Ask Google for suggestions".
165 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY, 165 proxy_->AddMenuItem(IDC_SPELLCHECK_ADD_TO_DICTIONARY,
166 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY)); 166 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY));
167 167
168 #if defined(TOOLKIT_GTK) 168 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE,
169 extensions::ViewType view_type = 169 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE));
170 extensions::GetViewType(proxy_->GetWebContents());
171 if (view_type != extensions::VIEW_TYPE_PANEL) {
172 #endif
173 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_SPELLING_TOGGLE,
174 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE));
175 #if defined(TOOLKIT_GTK)
176 }
177 #endif
178 170
179 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 171 const CommandLine* command_line = CommandLine::ForCurrentProcess();
180 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) { 172 if (command_line->HasSwitch(switches::kEnableSpellingAutoCorrect)) {
181 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE, 173 proxy_->AddCheckItem(IDC_CONTENT_CONTEXT_AUTOCORRECT_SPELLING_TOGGLE,
182 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT)); 174 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_AUTOCORRECT));
183 } 175 }
184 176
185 proxy_->AddSeparator(); 177 proxy_->AddSeparator();
186 } 178 }
187 179
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // Append '.' characters to the end of "Checking". 401 // Append '.' characters to the end of "Checking".
410 loading_frame_ = (loading_frame_ + 1) & 3; 402 loading_frame_ = (loading_frame_ + 1) & 3;
411 base::string16 loading_message = 403 base::string16 loading_message =
412 loading_message_ + base::string16(loading_frame_,'.'); 404 loading_message_ + base::string16(loading_frame_,'.');
413 405
414 // Update the menu item with the text. We disable this item to prevent users 406 // Update the menu item with the text. We disable this item to prevent users
415 // from selecting it. 407 // from selecting it.
416 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, 408 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false,
417 loading_message); 409 loading_message);
418 } 410 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698