| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 ExtensionFunction::ResponseAction | 396 ExtensionFunction::ResponseAction |
| 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(OneArgument(base::MakeUnique<base::Value>(success))); |
| 407 OneArgument(base::MakeUnique<base::FundamentalValue>(success))); | |
| 408 } | 407 } |
| 409 | 408 |
| 410 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: | 409 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: |
| 411 LanguageSettingsPrivateRemoveSpellcheckWordFunction() { | 410 LanguageSettingsPrivateRemoveSpellcheckWordFunction() { |
| 412 } | 411 } |
| 413 | 412 |
| 414 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: | 413 LanguageSettingsPrivateRemoveSpellcheckWordFunction:: |
| 415 ~LanguageSettingsPrivateRemoveSpellcheckWordFunction() { | 414 ~LanguageSettingsPrivateRemoveSpellcheckWordFunction() { |
| 416 } | 415 } |
| 417 | 416 |
| 418 ExtensionFunction::ResponseAction | 417 ExtensionFunction::ResponseAction |
| 419 LanguageSettingsPrivateRemoveSpellcheckWordFunction::Run() { | 418 LanguageSettingsPrivateRemoveSpellcheckWordFunction::Run() { |
| 420 std::unique_ptr<language_settings_private::RemoveSpellcheckWord::Params> | 419 std::unique_ptr<language_settings_private::RemoveSpellcheckWord::Params> |
| 421 params = language_settings_private::RemoveSpellcheckWord::Params::Create( | 420 params = language_settings_private::RemoveSpellcheckWord::Params::Create( |
| 422 *args_); | 421 *args_); |
| 423 EXTENSION_FUNCTION_VALIDATE(params.get()); | 422 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 424 | 423 |
| 425 SpellcheckService* service = | 424 SpellcheckService* service = |
| 426 SpellcheckServiceFactory::GetForContext(browser_context()); | 425 SpellcheckServiceFactory::GetForContext(browser_context()); |
| 427 bool success = service->GetCustomDictionary()->RemoveWord(params->word); | 426 bool success = service->GetCustomDictionary()->RemoveWord(params->word); |
| 428 | 427 |
| 429 return RespondNow( | 428 return RespondNow(OneArgument(base::MakeUnique<base::Value>(success))); |
| 430 OneArgument(base::MakeUnique<base::FundamentalValue>(success))); | |
| 431 } | 429 } |
| 432 | 430 |
| 433 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: | 431 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: |
| 434 LanguageSettingsPrivateGetTranslateTargetLanguageFunction() | 432 LanguageSettingsPrivateGetTranslateTargetLanguageFunction() |
| 435 : chrome_details_(this) { | 433 : chrome_details_(this) { |
| 436 } | 434 } |
| 437 | 435 |
| 438 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: | 436 LanguageSettingsPrivateGetTranslateTargetLanguageFunction:: |
| 439 ~LanguageSettingsPrivateGetTranslateTargetLanguageFunction() { | 437 ~LanguageSettingsPrivateGetTranslateTargetLanguageFunction() { |
| 440 } | 438 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 input_method_list.end(), input_method_id); | 606 input_method_list.end(), input_method_id); |
| 609 if (pos != input_method_list.end()) { | 607 if (pos != input_method_list.end()) { |
| 610 input_method_list.erase(pos); | 608 input_method_list.erase(pos); |
| 611 prefs->SetString(pref_name, base::JoinString(input_method_list, ",")); | 609 prefs->SetString(pref_name, base::JoinString(input_method_list, ",")); |
| 612 } | 610 } |
| 613 #endif | 611 #endif |
| 614 return RespondNow(NoArguments()); | 612 return RespondNow(NoArguments()); |
| 615 } | 613 } |
| 616 | 614 |
| 617 } // namespace extensions | 615 } // namespace extensions |
| OLD | NEW |