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

Side by Side Diff: chrome/browser/extensions/api/search_engines_private/search_engines_private_api.cc

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more tests that don't set short_name Created 5 years, 7 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
OLDNEW
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/search_engines_private/search_engines_pr ivate_api.h" 5 #include "chrome/browser/extensions/api/search_engines_private/search_engines_pr ivate_api.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/extensions/chrome_extension_function.h" 10 #include "chrome/browser/extensions/chrome_extension_function.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ~SearchEnginesPrivateAddOtherSearchEngineFunction() { 113 ~SearchEnginesPrivateAddOtherSearchEngineFunction() {
114 } 114 }
115 115
116 ExtensionFunction::ResponseAction 116 ExtensionFunction::ResponseAction
117 SearchEnginesPrivateAddOtherSearchEngineFunction::Run() { 117 SearchEnginesPrivateAddOtherSearchEngineFunction::Run() {
118 scoped_ptr<search_engines_private::AddOtherSearchEngine::Params> parameters = 118 scoped_ptr<search_engines_private::AddOtherSearchEngine::Params> parameters =
119 search_engines_private::AddOtherSearchEngine::Params::Create(*args_); 119 search_engines_private::AddOtherSearchEngine::Params::Create(*args_);
120 EXTENSION_FUNCTION_VALIDATE(parameters.get()); 120 EXTENSION_FUNCTION_VALIDATE(parameters.get());
121 121
122 TemplateURLData data; 122 TemplateURLData data;
123 data.short_name = base::ASCIIToUTF16(parameters->name); 123 data.SetShortName(base::ASCIIToUTF16(parameters->name));
124 data.SetKeyword(base::ASCIIToUTF16(parameters->keyword)); 124 data.SetKeyword(base::ASCIIToUTF16(parameters->keyword));
125 data.SetURL(parameters->url); 125 data.SetURL(parameters->url);
126 TemplateURL* turl = new TemplateURL(data); 126 TemplateURL* turl = new TemplateURL(data);
127 127
128 TemplateURLService* template_url_service = 128 TemplateURLService* template_url_service =
129 TemplateURLServiceFactory::GetForProfile(chrome_details_.GetProfile()); 129 TemplateURLServiceFactory::GetForProfile(chrome_details_.GetProfile());
130 template_url_service->Add(turl); 130 template_url_service->Add(turl);
131 return RespondNow(NoArguments()); 131 return RespondNow(NoArguments());
132 } 132 }
133 133
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } else { 329 } else {
330 if (prefs->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled)) 330 if (prefs->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled))
331 return RespondNow(Error(kAlreadyOptedInError)); 331 return RespondNow(Error(kAlreadyOptedInError));
332 } 332 }
333 333
334 hotword_service->OptIntoHotwording(launch_mode); 334 hotword_service->OptIntoHotwording(launch_mode);
335 return RespondNow(NoArguments()); 335 return RespondNow(NoArguments());
336 } 336 }
337 337
338 } // namespace extensions 338 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698