OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 // TODO(avi): remove when conversions not needed any more | 10 // TODO(avi): remove when conversions not needed any more |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 string16 HintInfoBar::GetMessageText() const { | 126 string16 HintInfoBar::GetMessageText() const { |
127 return l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_TEXT); | 127 return l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_TEXT); |
128 } | 128 } |
129 | 129 |
130 int HintInfoBar::GetButtons() const { | 130 int HintInfoBar::GetButtons() const { |
131 return BUTTON_OK; | 131 return BUTTON_OK; |
132 } | 132 } |
133 | 133 |
134 string16 HintInfoBar::GetButtonLabel(InfoBarButton button) const { | 134 string16 HintInfoBar::GetButtonLabel(InfoBarButton button) const { |
| 135 DCHECK_EQ(BUTTON_OK, button); |
135 return l10n_util::GetStringUTF16( | 136 return l10n_util::GetStringUTF16( |
136 IDS_OMNIBOX_SEARCH_HINT_INFOBAR_BUTTON_LABEL); | 137 IDS_OMNIBOX_SEARCH_HINT_INFOBAR_BUTTON_LABEL); |
137 } | 138 } |
138 | 139 |
139 bool HintInfoBar::Accept() { | 140 bool HintInfoBar::Accept() { |
140 action_taken_ = true; | 141 action_taken_ = true; |
141 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.ShowMe", 1); | 142 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.ShowMe", 1); |
142 omnibox_hint_->DisableHint(); | 143 omnibox_hint_->DisableHint(); |
143 omnibox_hint_->ShowEnteringQuery(); | 144 omnibox_hint_->ShowEnteringQuery(); |
144 return true; | 145 return true; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 227 } |
227 | 228 |
228 // static | 229 // static |
229 bool OmniboxSearchHint::IsEnabled(Profile* profile) { | 230 bool OmniboxSearchHint::IsEnabled(Profile* profile) { |
230 // The infobar can only be shown if the correct switch has been provided and | 231 // The infobar can only be shown if the correct switch has been provided and |
231 // the user did not dismiss the infobar before. | 232 // the user did not dismiss the infobar before. |
232 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && | 233 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && |
233 CommandLine::ForCurrentProcess()->HasSwitch( | 234 CommandLine::ForCurrentProcess()->HasSwitch( |
234 switches::kSearchInOmniboxHint); | 235 switches::kSearchInOmniboxHint); |
235 } | 236 } |
OLD | NEW |