Index: chrome/browser/tab_contents/spelling_bubble_model.cc |
diff --git a/chrome/browser/tab_contents/spelling_bubble_model.cc b/chrome/browser/tab_contents/spelling_bubble_model.cc |
index 7db4adef56af8b721d31a3f1ebe84b1b3325797f..57752f167b2b02451d1b6d15e7c77f4b9fa63e6d 100644 |
--- a/chrome/browser/tab_contents/spelling_bubble_model.cc |
+++ b/chrome/browser/tab_contents/spelling_bubble_model.cc |
@@ -51,14 +51,11 @@ string16 SpellingBubbleModel::GetButtonLabel(BubbleButton button) const { |
} |
void SpellingBubbleModel::Accept() { |
- PrefService* pref = profile_->GetPrefs(); |
- DCHECK(pref); |
- pref->SetBoolean(prefs::kSpellCheckUseSpellingService, true); |
- if (include_autocorrect_) |
- pref->SetBoolean(prefs::kEnableAutoSpellCorrect, true); |
+ SetPref(true); |
} |
void SpellingBubbleModel::Cancel() { |
+ SetPref(false); |
} |
string16 SpellingBubbleModel::GetLinkText() const { |
@@ -71,3 +68,11 @@ void SpellingBubbleModel::LinkClicked() { |
content::PAGE_TRANSITION_LINK, false); |
web_contents_->OpenURL(params); |
} |
+ |
+void SpellingBubbleModel::SetPref(bool enabled) { |
+ PrefService* pref = profile_->GetPrefs(); |
+ DCHECK(pref); |
+ pref->SetBoolean(prefs::kSpellCheckUseSpellingService, enabled); |
+ if (include_autocorrect_) |
+ pref->SetBoolean(prefs::kEnableAutoSpellCorrect, enabled); |
+} |