OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/tab_contents/spelling_bubble_model.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/pref_names.h" |
| 11 #include "grit/generated_resources.h" |
| 12 #include "grit/theme_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/gfx/image/image.h" |
| 16 |
| 17 SpellingBubbleModel::SpellingBubbleModel(Profile* profile) |
| 18 : profile_(profile) { |
| 19 } |
| 20 |
| 21 SpellingBubbleModel::~SpellingBubbleModel() { |
| 22 } |
| 23 |
| 24 string16 SpellingBubbleModel::GetTitle() const { |
| 25 return l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); |
| 26 } |
| 27 |
| 28 string16 SpellingBubbleModel::GetMessageText() const { |
| 29 return l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT); |
| 30 } |
| 31 |
| 32 gfx::Image* SpellingBubbleModel::GetIcon() const { |
| 33 return &ResourceBundle::GetSharedInstance().GetImageNamed( |
| 34 IDR_PRODUCT_LOGO_16); |
| 35 } |
| 36 |
| 37 string16 SpellingBubbleModel::GetButtonLabel(BubbleButton button) const { |
| 38 return l10n_util::GetStringUTF16(button == BUTTON_OK ? |
| 39 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE : |
| 40 IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE); |
| 41 } |
| 42 |
| 43 void SpellingBubbleModel::Accept() { |
| 44 PrefService* pref = profile_->GetPrefs(); |
| 45 DCHECK(pref); |
| 46 pref->SetBoolean(prefs::kSpellCheckUseSpellingService, true); |
| 47 } |
| 48 |
| 49 void SpellingBubbleModel::Cancel() { |
| 50 } |
OLD | NEW |