OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/omnibox_search_hint.h" | 5 #include "chrome/browser/omnibox_search_hint.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
38 #include "grit/theme_resources.h" | 38 #include "grit/theme_resources.h" |
39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
41 | 41 |
42 using content::NavigationController; | 42 using content::NavigationController; |
43 using content::NavigationEntry; | 43 using content::NavigationEntry; |
44 | 44 |
45 int OmniboxSearchHint::kUserDataKey; | 45 DEFINE_WEB_CONTENTS_USER_DATA_KEY(OmniboxSearchHint) |
46 | 46 |
47 // The URLs of search engines for which we want to trigger the infobar. | 47 // The URLs of search engines for which we want to trigger the infobar. |
48 const char* const kSearchEngineURLs[] = { | 48 const char* const kSearchEngineURLs[] = { |
49 "http://www.google.com/", | 49 "http://www.google.com/", |
50 "http://www.yahoo.com/", | 50 "http://www.yahoo.com/", |
51 "http://www.bing.com/", | 51 "http://www.bing.com/", |
52 "http://www.altavista.com/", | 52 "http://www.altavista.com/", |
53 "http://www.ask.com/", | 53 "http://www.ask.com/", |
54 "http://www.wolframalpha.com/", | 54 "http://www.wolframalpha.com/", |
55 }; | 55 }; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 // static | 246 // static |
247 bool OmniboxSearchHint::IsEnabled(Profile* profile) { | 247 bool OmniboxSearchHint::IsEnabled(Profile* profile) { |
248 // The infobar can only be shown if the correct switch has been provided and | 248 // The infobar can only be shown if the correct switch has been provided and |
249 // the user did not dismiss the infobar before. | 249 // the user did not dismiss the infobar before. |
250 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && | 250 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && |
251 CommandLine::ForCurrentProcess()->HasSwitch( | 251 CommandLine::ForCurrentProcess()->HasSwitch( |
252 switches::kSearchInOmniboxHint); | 252 switches::kSearchInOmniboxHint); |
253 } | 253 } |
OLD | NEW |