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

Side by Side Diff: chrome/browser/ui/webui/options/language_dictionary_overlay_handler.cc

Issue 11968050: Show dictionary changes in chrome://settings/editDictionary as changes come in (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/options/edit_dictionary_browsertest.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/webui/options/language_dictionary_overlay_handler.h" 5 #include "chrome/browser/ui/webui/options/language_dictionary_overlay_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/spellchecker/spellcheck_factory.h" 10 #include "chrome/browser/spellchecker/spellcheck_factory.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (dictionary_) 70 if (dictionary_)
71 dictionary_->RemoveObserver(this); 71 dictionary_->RemoveObserver(this);
72 } 72 }
73 73
74 void LanguageDictionaryOverlayHandler::OnCustomDictionaryLoaded() { 74 void LanguageDictionaryOverlayHandler::OnCustomDictionaryLoaded() {
75 ResetDictionaryWords(); 75 ResetDictionaryWords();
76 } 76 }
77 77
78 void LanguageDictionaryOverlayHandler::OnCustomDictionaryWordAdded( 78 void LanguageDictionaryOverlayHandler::OnCustomDictionaryWordAdded(
79 const std::string& word) { 79 const std::string& word) {
80 ListValue add_words;
81 ListValue remove_words;
82 add_words.AppendString(word);
83 web_ui()->CallJavascriptFunction("EditDictionaryOverlay.updateWords",
84 add_words,
85 remove_words);
80 } 86 }
81 87
82 void LanguageDictionaryOverlayHandler::OnCustomDictionaryWordRemoved( 88 void LanguageDictionaryOverlayHandler::OnCustomDictionaryWordRemoved(
83 const std::string& word) { 89 const std::string& word) {
90 ListValue add_words;
91 ListValue remove_words;
92 remove_words.AppendString(word);
93 web_ui()->CallJavascriptFunction("EditDictionaryOverlay.updateWords",
94 add_words,
95 remove_words);
84 } 96 }
85 97
86 void LanguageDictionaryOverlayHandler::ResetDictionaryWords() { 98 void LanguageDictionaryOverlayHandler::ResetDictionaryWords() {
87 if (!overlay_initialized_) 99 if (!overlay_initialized_)
88 return; 100 return;
89 101
90 if (!dictionary_) { 102 if (!dictionary_) {
91 dictionary_ = SpellcheckServiceFactory::GetForProfile( 103 dictionary_ = SpellcheckServiceFactory::GetForProfile(
92 Profile::FromWebUI(web_ui()))->GetCustomDictionary(); 104 Profile::FromWebUI(web_ui()))->GetCustomDictionary();
93 dictionary_->AddObserver(this); 105 dictionary_->AddObserver(this);
(...skipping 22 matching lines...) Expand all
116 void LanguageDictionaryOverlayHandler::RemoveWord(const ListValue* args) { 128 void LanguageDictionaryOverlayHandler::RemoveWord(const ListValue* args) {
117 std::string old_word; 129 std::string old_word;
118 if (!args->GetString(0, &old_word) || old_word.empty() || !dictionary_) { 130 if (!args->GetString(0, &old_word) || old_word.empty() || !dictionary_) {
119 NOTREACHED(); 131 NOTREACHED();
120 return; 132 return;
121 } 133 }
122 dictionary_->RemoveWord(old_word); 134 dictionary_->RemoveWord(old_word);
123 } 135 }
124 136
125 } // namespace options 137 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/edit_dictionary_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698