OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 delete this; | 63 delete this; |
64 } | 64 } |
65 | 65 |
66 virtual void InfoBarDismissed() { | 66 virtual void InfoBarDismissed() { |
67 action_taken_ = true; | 67 action_taken_ = true; |
68 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.Closed", 1); | 68 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.Closed", 1); |
69 // User closed the infobar, let's not bug him again with this in the future. | 69 // User closed the infobar, let's not bug him again with this in the future. |
70 omnibox_hint_->DisableHint(); | 70 omnibox_hint_->DisableHint(); |
71 } | 71 } |
72 | 72 |
73 virtual std::wstring GetMessageText() const { | 73 virtual string16 GetMessageText() const { |
74 return l10n_util::GetString(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_TEXT); | 74 return l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_TEXT); |
75 } | 75 } |
76 | 76 |
77 virtual SkBitmap* GetIcon() const { | 77 virtual SkBitmap* GetIcon() const { |
78 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 78 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
79 IDR_INFOBAR_QUESTION_MARK); | 79 IDR_INFOBAR_QUESTION_MARK); |
80 } | 80 } |
81 | 81 |
82 virtual int GetButtons() const { | 82 virtual int GetButtons() const { |
83 return BUTTON_OK; | 83 return BUTTON_OK; |
84 } | 84 } |
85 | 85 |
86 virtual std::wstring GetButtonLabel(InfoBarButton button) const { | 86 virtual string16 GetButtonLabel(InfoBarButton button) const { |
87 return l10n_util::GetString(IDS_OMNIBOX_SEARCH_HINT_INFOBAR_BUTTON_LABEL); | 87 return l10n_util::GetStringUTF16( |
| 88 IDS_OMNIBOX_SEARCH_HINT_INFOBAR_BUTTON_LABEL); |
88 } | 89 } |
89 | 90 |
90 virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; } | 91 virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; } |
91 | 92 |
92 virtual bool Accept() { | 93 virtual bool Accept() { |
93 action_taken_ = true; | 94 action_taken_ = true; |
94 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.ShowMe", 1); | 95 UMA_HISTOGRAM_COUNTS("OmniboxSearchHint.ShowMe", 1); |
95 omnibox_hint_->DisableHint(); | 96 omnibox_hint_->DisableHint(); |
96 omnibox_hint_->ShowEnteringQuery(); | 97 omnibox_hint_->ShowEnteringQuery(); |
97 return true; | 98 return true; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 197 } |
197 | 198 |
198 // static | 199 // static |
199 bool OmniboxSearchHint::IsEnabled(Profile* profile) { | 200 bool OmniboxSearchHint::IsEnabled(Profile* profile) { |
200 // The infobar can only be shown if the correct switch has been provided and | 201 // The infobar can only be shown if the correct switch has been provided and |
201 // the user did not dismiss the infobar before. | 202 // the user did not dismiss the infobar before. |
202 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && | 203 return profile->GetPrefs()->GetBoolean(prefs::kShowOmniboxSearchHint) && |
203 CommandLine::ForCurrentProcess()->HasSwitch( | 204 CommandLine::ForCurrentProcess()->HasSwitch( |
204 switches::kSearchInOmniboxHint); | 205 switches::kSearchInOmniboxHint); |
205 } | 206 } |
OLD | NEW |