OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_contents/spelling_menu_observer.h" | 5 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
30 | 30 |
31 using content::BrowserThread; | 31 using content::BrowserThread; |
32 | 32 |
33 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) | 33 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) |
34 : proxy_(proxy), | 34 : proxy_(proxy), |
35 loading_frame_(0), | 35 loading_frame_(0), |
36 succeeded_(false) { | 36 succeeded_(false) { |
37 if (proxy && proxy->GetProfile()) | 37 if (proxy && proxy->GetProfile()) |
38 integrate_spelling_service_.Init(prefs::kSpellCheckUseSpellingService, | 38 integrate_spelling_service_.Init(prefs::kSpellCheckUseSpellingService, |
39 proxy->GetProfile()->GetPrefs(), NULL); | 39 proxy->GetProfile()->GetPrefs()); |
40 } | 40 } |
41 | 41 |
42 SpellingMenuObserver::~SpellingMenuObserver() { | 42 SpellingMenuObserver::~SpellingMenuObserver() { |
43 } | 43 } |
44 | 44 |
45 void SpellingMenuObserver::InitMenu(const content::ContextMenuParams& params) { | 45 void SpellingMenuObserver::InitMenu(const content::ContextMenuParams& params) { |
46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
47 DCHECK(!params.misspelled_word.empty() || | 47 DCHECK(!params.misspelled_word.empty() || |
48 params.dictionary_suggestions.empty()); | 48 params.dictionary_suggestions.empty()); |
49 | 49 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 void SpellingMenuObserver::OnAnimationTimerExpired() { | 294 void SpellingMenuObserver::OnAnimationTimerExpired() { |
295 // Append '.' characters to the end of "Checking". | 295 // Append '.' characters to the end of "Checking". |
296 loading_frame_ = (loading_frame_ + 1) & 3; | 296 loading_frame_ = (loading_frame_ + 1) & 3; |
297 string16 loading_message = loading_message_ + string16(loading_frame_,'.'); | 297 string16 loading_message = loading_message_ + string16(loading_frame_,'.'); |
298 | 298 |
299 // Update the menu item with the text. We disable this item to prevent users | 299 // Update the menu item with the text. We disable this item to prevent users |
300 // from selecting it. | 300 // from selecting it. |
301 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 301 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
302 loading_message); | 302 loading_message); |
303 } | 303 } |
OLD | NEW |