Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: chrome/browser/tab_contents/spelling_bubble_model.cc

Issue 12222003: Rebase ConfirmBubbleViews on DialogDelegateView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase to retry CQ. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_bubble_model.h" 5 #include "chrome/browser/tab_contents/spelling_bubble_model.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 IDR_PRODUCT_LOGO_16); 44 IDR_PRODUCT_LOGO_16);
45 } 45 }
46 46
47 string16 SpellingBubbleModel::GetButtonLabel(BubbleButton button) const { 47 string16 SpellingBubbleModel::GetButtonLabel(BubbleButton button) const {
48 return l10n_util::GetStringUTF16(button == BUTTON_OK ? 48 return l10n_util::GetStringUTF16(button == BUTTON_OK ?
49 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE : 49 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE :
50 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE); 50 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE);
51 } 51 }
52 52
53 void SpellingBubbleModel::Accept() { 53 void SpellingBubbleModel::Accept() {
54 PrefService* pref = profile_->GetPrefs(); 54 SetPref(true);
55 DCHECK(pref);
56 pref->SetBoolean(prefs::kSpellCheckUseSpellingService, true);
57 if (include_autocorrect_)
58 pref->SetBoolean(prefs::kEnableAutoSpellCorrect, true);
59 } 55 }
60 56
61 void SpellingBubbleModel::Cancel() { 57 void SpellingBubbleModel::Cancel() {
58 SetPref(false);
62 } 59 }
63 60
64 string16 SpellingBubbleModel::GetLinkText() const { 61 string16 SpellingBubbleModel::GetLinkText() const {
65 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 62 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
66 } 63 }
67 64
68 void SpellingBubbleModel::LinkClicked() { 65 void SpellingBubbleModel::LinkClicked() {
69 OpenURLParams params( 66 OpenURLParams params(
70 GURL(chrome::kPrivacyLearnMoreURL), Referrer(), NEW_FOREGROUND_TAB, 67 GURL(chrome::kPrivacyLearnMoreURL), Referrer(), NEW_FOREGROUND_TAB,
71 content::PAGE_TRANSITION_LINK, false); 68 content::PAGE_TRANSITION_LINK, false);
72 web_contents_->OpenURL(params); 69 web_contents_->OpenURL(params);
73 } 70 }
71
72 void SpellingBubbleModel::SetPref(bool enabled) {
73 PrefService* pref = profile_->GetPrefs();
74 DCHECK(pref);
75 pref->SetBoolean(prefs::kSpellCheckUseSpellingService, enabled);
76 if (include_autocorrect_)
77 pref->SetBoolean(prefs::kEnableAutoSpellCorrect, enabled);
78 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/spelling_bubble_model.h ('k') | chrome/browser/tab_contents/spelling_menu_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698