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_bubble_model.h" | 5 #include "chrome/browser/renderer_context_menu/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 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 base::string16 SpellingBubbleModel::GetTitle() const { | 36 base::string16 SpellingBubbleModel::GetTitle() const { |
37 return l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); | 37 return l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); |
38 } | 38 } |
39 | 39 |
40 base::string16 SpellingBubbleModel::GetMessageText() const { | 40 base::string16 SpellingBubbleModel::GetMessageText() const { |
41 return l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT); | 41 return l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT); |
42 } | 42 } |
43 | 43 |
44 gfx::Image* SpellingBubbleModel::GetIcon() const { | |
45 return &ResourceBundle::GetSharedInstance().GetImageNamed( | |
46 IDR_PRODUCT_LOGO_16); | |
47 } | |
48 | |
49 base::string16 SpellingBubbleModel::GetButtonLabel(BubbleButton button) const { | 44 base::string16 SpellingBubbleModel::GetButtonLabel(BubbleButton button) const { |
50 return l10n_util::GetStringUTF16(button == BUTTON_OK ? | 45 return l10n_util::GetStringUTF16(button == BUTTON_OK ? |
51 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE : | 46 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE : |
52 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE); | 47 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE); |
53 } | 48 } |
54 | 49 |
55 void SpellingBubbleModel::Accept() { | 50 void SpellingBubbleModel::Accept() { |
56 SetPref(true); | 51 SetPref(true); |
57 } | 52 } |
58 | 53 |
(...skipping 12 matching lines...) Expand all Loading... |
71 web_contents_->OpenURL(params); | 66 web_contents_->OpenURL(params); |
72 } | 67 } |
73 | 68 |
74 void SpellingBubbleModel::SetPref(bool enabled) { | 69 void SpellingBubbleModel::SetPref(bool enabled) { |
75 PrefService* pref = profile_->GetPrefs(); | 70 PrefService* pref = profile_->GetPrefs(); |
76 DCHECK(pref); | 71 DCHECK(pref); |
77 pref->SetBoolean(prefs::kSpellCheckUseSpellingService, enabled); | 72 pref->SetBoolean(prefs::kSpellCheckUseSpellingService, enabled); |
78 if (include_autocorrect_) | 73 if (include_autocorrect_) |
79 pref->SetBoolean(prefs::kEnableAutoSpellCorrect, enabled); | 74 pref->SetBoolean(prefs::kEnableAutoSpellCorrect, enabled); |
80 } | 75 } |
OLD | NEW |