| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/i18n/case_conversion.h" | 11 #include "base/i18n/case_conversion.h" |
| 10 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 16 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 15 #include "chrome/browser/renderer_context_menu/spelling_bubble_model.h" | 17 #include "chrome/browser/renderer_context_menu/spelling_bubble_model.h" |
| 16 #include "chrome/browser/spellchecker/feedback_sender.h" | 18 #include "chrome/browser/spellchecker/feedback_sender.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // item, we directly update/ the profile and stop integrating the spelling | 288 // item, we directly update/ the profile and stop integrating the spelling |
| 287 // service immediately. | 289 // service immediately. |
| 288 if (!integrate_spelling_service_.GetValue()) { | 290 if (!integrate_spelling_service_.GetValue()) { |
| 289 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 291 content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
| 290 gfx::Rect rect = rvh->GetWidget()->GetView()->GetViewBounds(); | 292 gfx::Rect rect = rvh->GetWidget()->GetView()->GetViewBounds(); |
| 291 scoped_ptr<SpellingBubbleModel> model( | 293 scoped_ptr<SpellingBubbleModel> model( |
| 292 new SpellingBubbleModel(profile, proxy_->GetWebContents())); | 294 new SpellingBubbleModel(profile, proxy_->GetWebContents())); |
| 293 chrome::ShowConfirmBubble( | 295 chrome::ShowConfirmBubble( |
| 294 proxy_->GetWebContents()->GetTopLevelNativeWindow(), | 296 proxy_->GetWebContents()->GetTopLevelNativeWindow(), |
| 295 rvh->GetWidget()->GetView()->GetNativeView(), | 297 rvh->GetWidget()->GetView()->GetNativeView(), |
| 296 gfx::Point(rect.CenterPoint().x(), rect.y()), model.Pass()); | 298 gfx::Point(rect.CenterPoint().x(), rect.y()), std::move(model)); |
| 297 } else { | 299 } else { |
| 298 if (profile) { | 300 if (profile) { |
| 299 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, | 301 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, |
| 300 false); | 302 false); |
| 301 } | 303 } |
| 302 } | 304 } |
| 303 } | 305 } |
| 304 } | 306 } |
| 305 | 307 |
| 306 void SpellingMenuObserver::OnMenuCancel() { | 308 void SpellingMenuObserver::OnMenuCancel() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // Append '.' characters to the end of "Checking". | 362 // Append '.' characters to the end of "Checking". |
| 361 loading_frame_ = (loading_frame_ + 1) & 3; | 363 loading_frame_ = (loading_frame_ + 1) & 3; |
| 362 base::string16 loading_message = | 364 base::string16 loading_message = |
| 363 loading_message_ + base::string16(loading_frame_,'.'); | 365 loading_message_ + base::string16(loading_frame_,'.'); |
| 364 | 366 |
| 365 // Update the menu item with the text. We disable this item to prevent users | 367 // Update the menu item with the text. We disable this item to prevent users |
| 366 // from selecting it. | 368 // from selecting it. |
| 367 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 369 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
| 368 loading_message); | 370 loading_message); |
| 369 } | 371 } |
| OLD | NEW |