OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/search_engines/util.h" |
| 6 |
| 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/search_engines/template_url_model.h" |
| 9 #include "chrome/browser/profile.h" |
| 10 |
| 11 string16 GetDefaultSearchEngineName(Profile* profile) { |
| 12 if (!profile) { |
| 13 NOTREACHED(); |
| 14 return string16(); |
| 15 } |
| 16 const TemplateURL* const default_provider = |
| 17 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); |
| 18 if (!default_provider) { |
| 19 // TODO(cpu): bug 1187517. It is possible to have no default provider. |
| 20 // returning an empty string is a stopgap measure for the crash |
| 21 // http://code.google.com/p/chromium/issues/detail?id=2573 |
| 22 return string16(); |
| 23 } |
| 24 return WideToUTF16(default_provider->short_name()); |
| 25 } |
OLD | NEW |