| Index: chrome/browser/search_engines/util.cc
|
| diff --git a/chrome/browser/search_engines/util.cc b/chrome/browser/search_engines/util.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..28e1c93f41922cea0431859a93fb00292d8059ea
|
| --- /dev/null
|
| +++ b/chrome/browser/search_engines/util.cc
|
| @@ -0,0 +1,25 @@
|
| +// 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());
|
| +}
|
|
|