| 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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 spellcheck_mac::AddWord(misspelled_word_); | 222 spellcheck_mac::AddWord(misspelled_word_); |
| 223 #endif | 223 #endif |
| 224 } | 224 } |
| 225 | 225 |
| 226 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) { | 226 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) { |
| 227 // When a user enables the "Ask Google for spelling suggestions" item, we | 227 // When a user enables the "Ask Google for spelling suggestions" item, we |
| 228 // show a bubble to confirm it. On the other hand, when a user disables this | 228 // show a bubble to confirm it. On the other hand, when a user disables this |
| 229 // item, we directly update/ the profile and stop integrating the spelling | 229 // item, we directly update/ the profile and stop integrating the spelling |
| 230 // service immediately. | 230 // service immediately. |
| 231 if (!integrate_spelling_service_) { | 231 if (!integrate_spelling_service_) { |
| 232 RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 232 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
| 233 gfx::Rect rect = rvh->GetView()->GetViewBounds(); | 233 gfx::Rect rect = rvh->GetView()->GetViewBounds(); |
| 234 ConfirmBubbleModel::Show(rvh->GetView()->GetNativeView(), | 234 ConfirmBubbleModel::Show(rvh->GetView()->GetNativeView(), |
| 235 gfx::Point(rect.CenterPoint().x(), rect.y()), | 235 gfx::Point(rect.CenterPoint().x(), rect.y()), |
| 236 new SpellingBubbleModel(proxy_->GetProfile())); | 236 new SpellingBubbleModel(proxy_->GetProfile())); |
| 237 } else { | 237 } else { |
| 238 Profile* profile = proxy_->GetProfile(); | 238 Profile* profile = proxy_->GetProfile(); |
| 239 if (profile) | 239 if (profile) |
| 240 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, | 240 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, |
| 241 false); | 241 false); |
| 242 } | 242 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 loading_frame_ = (loading_frame_ + 1) & 3; | 285 loading_frame_ = (loading_frame_ + 1) & 3; |
| 286 string16 loading_message = loading_message_; | 286 string16 loading_message = loading_message_; |
| 287 for (int i = 0; i < loading_frame_; ++i) | 287 for (int i = 0; i < loading_frame_; ++i) |
| 288 loading_message.push_back('.'); | 288 loading_message.push_back('.'); |
| 289 | 289 |
| 290 // Update the menu item with the text. We disable this item to prevent users | 290 // Update the menu item with the text. We disable this item to prevent users |
| 291 // from selecting it. | 291 // from selecting it. |
| 292 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 292 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
| 293 loading_message); | 293 loading_message); |
| 294 } | 294 } |
| OLD | NEW |