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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 #endif | 218 #endif |
219 } | 219 } |
220 | 220 |
221 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) { | 221 if (command_id == IDC_CONTENT_CONTEXT_SPELLING_TOGGLE) { |
222 // When a user chooses the "Ask Google for spelling suggestions" item, we | 222 // When a user chooses the "Ask Google for spelling suggestions" item, we |
223 // show a bubble to confirm it. On the other hand, when a user chooses the | 223 // show a bubble to confirm it. On the other hand, when a user chooses the |
224 // "Stop asking Google for spelling suggestions" item, we directly update | 224 // "Stop asking Google for spelling suggestions" item, we directly update |
225 // the profile and stop integrating the spelling service immediately. | 225 // the profile and stop integrating the spelling service immediately. |
226 if (!integrate_spelling_service_) { | 226 if (!integrate_spelling_service_) { |
227 RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 227 RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
228 gfx::Rect rect = rvh->view()->GetViewBounds(); | 228 gfx::Rect rect = rvh->GetView()->GetViewBounds(); |
229 ConfirmBubbleModel::Show(rvh->view()->GetNativeView(), | 229 ConfirmBubbleModel::Show(rvh->GetView()->GetNativeView(), |
230 gfx::Point(rect.CenterPoint().x(), rect.y()), | 230 gfx::Point(rect.CenterPoint().x(), rect.y()), |
231 new SpellingBubbleModel(proxy_->GetProfile())); | 231 new SpellingBubbleModel(proxy_->GetProfile())); |
232 } else { | 232 } else { |
233 Profile* profile = proxy_->GetProfile(); | 233 Profile* profile = proxy_->GetProfile(); |
234 if (profile) | 234 if (profile) |
235 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, | 235 profile->GetPrefs()->SetBoolean(prefs::kSpellCheckUseSpellingService, |
236 false); | 236 false); |
237 } | 237 } |
238 } | 238 } |
239 } | 239 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 loading_frame_ = (loading_frame_ + 1) & 3; | 280 loading_frame_ = (loading_frame_ + 1) & 3; |
281 string16 loading_message = loading_message_; | 281 string16 loading_message = loading_message_; |
282 for (int i = 0; i < loading_frame_; ++i) | 282 for (int i = 0; i < loading_frame_; ++i) |
283 loading_message.push_back('.'); | 283 loading_message.push_back('.'); |
284 | 284 |
285 // Update the menu item with the text. We disable this item to prevent users | 285 // Update the menu item with the text. We disable this item to prevent users |
286 // from selecting it. | 286 // from selecting it. |
287 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 287 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
288 loading_message); | 288 loading_message); |
289 } | 289 } |
OLD | NEW |