| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) { | 225 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) { |
| 226 // When a user enables the "Ask Google for spelling suggestions" item, we | 226 // When a user enables the "Ask Google for spelling suggestions" item, we |
| 227 // show a bubble to confirm it. On the other hand, when a user disables this | 227 // show a bubble to confirm it. On the other hand, when a user disables this |
| 228 // item, we directly update/ the profile and stop integrating the spelling | 228 // item, we directly update/ the profile and stop integrating the spelling |
| 229 // service immediately. | 229 // service immediately. |
| 230 if (!integrate_spelling_service_) { | 230 if (!integrate_spelling_service_) { |
| 231 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 231 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
| 232 gfx::Rect rect = rvh->GetView()->GetViewBounds(); | 232 gfx::Rect rect = rvh->GetView()->GetViewBounds(); |
| 233 browser::ShowConfirmBubble(rvh->GetView()->GetNativeView(), | 233 chrome::ShowConfirmBubble(rvh->GetView()->GetNativeView(), |
| 234 gfx::Point(rect.CenterPoint().x(), rect.y()), | 234 gfx::Point(rect.CenterPoint().x(), rect.y()), |
| 235 new SpellingBubbleModel( | 235 new SpellingBubbleModel( |
| 236 proxy_->GetProfile(), | 236 proxy_->GetProfile(), |
| 237 proxy_->GetWebContents())); | 237 proxy_->GetWebContents())); |
| 238 } else { | 238 } else { |
| 239 Profile* profile = proxy_->GetProfile(); | 239 Profile* profile = proxy_->GetProfile(); |
| 240 if (profile) | 240 if (profile) |
| 241 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, | 241 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, |
| 242 false); | 242 false); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 void SpellingMenuObserver::OnTextCheckComplete( | 247 void SpellingMenuObserver::OnTextCheckComplete( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 loading_frame_ = (loading_frame_ + 1) & 3; | 289 loading_frame_ = (loading_frame_ + 1) & 3; |
| 290 string16 loading_message = loading_message_; | 290 string16 loading_message = loading_message_; |
| 291 for (int i = 0; i < loading_frame_; ++i) | 291 for (int i = 0; i < loading_frame_; ++i) |
| 292 loading_message.push_back('.'); | 292 loading_message.push_back('.'); |
| 293 | 293 |
| 294 // Update the menu item with the text. We disable this item to prevent users | 294 // Update the menu item with the text. We disable this item to prevent users |
| 295 // from selecting it. | 295 // from selecting it. |
| 296 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 296 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
| 297 loading_message); | 297 loading_message); |
| 298 } | 298 } |
| OLD | NEW |