// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/search_engines/util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/search_engines/template_url_model.h" #include "chrome/browser/profile.h" string16 GetDefaultSearchEngineName(Profile* profile) { if (!profile) { NOTREACHED(); return string16(); } const TemplateURL* const default_provider = profile->GetTemplateURLModel()->GetDefaultSearchProvider(); if (!default_provider) { // TODO(cpu): bug 1187517. It is possible to have no default provider. // returning an empty string is a stopgap measure for the crash // http://code.google.com/p/chromium/issues/detail?id=2573 return string16(); } return WideToUTF16(default_provider->short_name()); }