| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/language_settings_private/language_setti
ngs_private_api.h" | 5 #include "chrome/browser/extensions/api/language_settings_private/language_setti
ngs_private_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 LanguageSettingsPrivateAddSpellcheckWordFunction::Run() { | 397 LanguageSettingsPrivateAddSpellcheckWordFunction::Run() { |
| 398 std::unique_ptr<language_settings_private::AddSpellcheckWord::Params> params = | 398 std::unique_ptr<language_settings_private::AddSpellcheckWord::Params> params = |
| 399 language_settings_private::AddSpellcheckWord::Params::Create(*args_); | 399 language_settings_private::AddSpellcheckWord::Params::Create(*args_); |
| 400 EXTENSION_FUNCTION_VALIDATE(params.get()); | 400 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 401 | 401 |
| 402 SpellcheckService* service = | 402 SpellcheckService* service = |
| 403 SpellcheckServiceFactory::GetForContext(browser_context()); | 403 SpellcheckServiceFactory::GetForContext(browser_context()); |
| 404 bool success = service->GetCustomDictionary()->AddWord(params->word); | 404 bool success = service->GetCustomDictionary()->AddWord(params->word); |
| 405 | 405 |
| 406 return RespondNow( | 406 return RespondNow( |
| 407 OneArgument(base::MakeUnique<base::FundamentalValue>(success))); | 407 OneArgument(base::MakeUnique<base::Value>(success))); |
| 408 } | 408 } |
| 409 | 409 |
| 410 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: | 410 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: |
| 411 LanguageSettingsPrivateRemoveSpellcheckWordFunction() { | 411 LanguageSettingsPrivateRemoveSpellcheckWordFunction() { |
| 412 } | 412 } |
| 413 | 413 |
| 414 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: | 414 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: |
| 415 ~LanguageSettingsPrivateRemoveSpellcheckWordFunction() { | 415 ~LanguageSettingsPrivateRemoveSpellcheckWordFunction() { |
| 416 } | 416 } |
| 417 | 417 |
| 418 ExtensionFunction::ResponseAction | 418 ExtensionFunction::ResponseAction |
| 419 LanguageSettingsPrivateRemoveSpellcheckWordFunction::Run() { | 419 LanguageSettingsPrivateRemoveSpellcheckWordFunction::Run() { |
| 420 std::unique_ptr<language_settings_private::RemoveSpellcheckWord::Params> | 420 std::unique_ptr<language_settings_private::RemoveSpellcheckWord::Params> |
| 421 params = language_settings_private::RemoveSpellcheckWord::Params::Create( | 421 params = language_settings_private::RemoveSpellcheckWord::Params::Create( |
| 422 *args_); | 422 *args_); |
| 423 EXTENSION_FUNCTION_VALIDATE(params.get()); | 423 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 424 | 424 |
| 425 SpellcheckService* service = | 425 SpellcheckService* service = |
| 426 SpellcheckServiceFactory::GetForContext(browser_context()); | 426 SpellcheckServiceFactory::GetForContext(browser_context()); |
| 427 bool success = service->GetCustomDictionary()->RemoveWord(params->word); | 427 bool success = service->GetCustomDictionary()->RemoveWord(params->word); |
| 428 | 428 |
| 429 return RespondNow( | 429 return RespondNow( |
| 430 OneArgument(base::MakeUnique<base::FundamentalValue>(success))); | 430 OneArgument(base::MakeUnique<base::Value>(success))); |
| 431 } | 431 } |
| 432 | 432 |
| 433 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: | 433 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: |
| 434 LanguageSettingsPrivateGetTranslateTargetLanguageFunction() | 434 LanguageSettingsPrivateGetTranslateTargetLanguageFunction() |
| 435 : chrome_details_(this) { | 435 : chrome_details_(this) { |
| 436 } | 436 } |
| 437 | 437 |
| 438 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: | 438 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: |
| 439 ~LanguageSettingsPrivateGetTranslateTargetLanguageFunction() { | 439 ~LanguageSettingsPrivateGetTranslateTargetLanguageFunction() { |
| 440 } | 440 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 input_method_list.end(), input_method_id); | 608 input_method_list.end(), input_method_id); |
| 609 if (pos != input_method_list.end()) { | 609 if (pos != input_method_list.end()) { |
| 610 input_method_list.erase(pos); | 610 input_method_list.erase(pos); |
| 611 prefs->SetString(pref_name, base::JoinString(input_method_list, ",")); | 611 prefs->SetString(pref_name, base::JoinString(input_method_list, ",")); |
| 612 } | 612 } |
| 613 #endif | 613 #endif |
| 614 return RespondNow(NoArguments()); | 614 return RespondNow(NoArguments()); |
| 615 } | 615 } |
| 616 | 616 |
| 617 } // namespace extensions | 617 } // namespace extensions |
| OLD | NEW |