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

Unified Diff: chrome/browser/search_engines/util.cc

Issue 2822026: Mac: First run bubble. (Closed)
Patch Set: '' Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
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());
+}

Powered by Google App Engine
This is Rietveld 408576698