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/ui/browser_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/event_recorder.h" | 10 #include "base/event_recorder.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 virtual ~DefaultBrowserInfoBarDelegate(); | 136 virtual ~DefaultBrowserInfoBarDelegate(); |
137 | 137 |
138 void AllowExpiry() { should_expire_ = true; } | 138 void AllowExpiry() { should_expire_ = true; } |
139 | 139 |
140 // ConfirmInfoBarDelegate: | 140 // ConfirmInfoBarDelegate: |
141 virtual bool ShouldExpire( | 141 virtual bool ShouldExpire( |
142 const NavigationController::LoadCommittedDetails& details) const; | 142 const NavigationController::LoadCommittedDetails& details) const; |
143 virtual void InfoBarClosed(); | 143 virtual void InfoBarClosed(); |
144 virtual SkBitmap* GetIcon() const; | 144 virtual SkBitmap* GetIcon() const; |
145 virtual string16 GetMessageText() const; | 145 virtual string16 GetMessageText() const; |
146 virtual int GetButtons() const; | |
147 virtual string16 GetButtonLabel(InfoBarButton button) const; | 146 virtual string16 GetButtonLabel(InfoBarButton button) const; |
148 virtual bool NeedElevation(InfoBarButton button) const; | 147 virtual bool NeedElevation(InfoBarButton button) const; |
149 virtual bool Accept(); | 148 virtual bool Accept(); |
150 virtual bool Cancel(); | 149 virtual bool Cancel(); |
151 | 150 |
152 private: | 151 private: |
153 // The Profile that we restore sessions from. | 152 // The Profile that we restore sessions from. |
154 Profile* profile_; | 153 Profile* profile_; |
155 | 154 |
156 // Whether the user clicked one of the buttons. | 155 // Whether the user clicked one of the buttons. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 194 |
196 SkBitmap* DefaultBrowserInfoBarDelegate::GetIcon() const { | 195 SkBitmap* DefaultBrowserInfoBarDelegate::GetIcon() const { |
197 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 196 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
198 IDR_PRODUCT_ICON_32); | 197 IDR_PRODUCT_ICON_32); |
199 } | 198 } |
200 | 199 |
201 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { | 200 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { |
202 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); | 201 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); |
203 } | 202 } |
204 | 203 |
205 int DefaultBrowserInfoBarDelegate::GetButtons() const { | |
206 return BUTTON_OK | BUTTON_CANCEL; | |
207 } | |
208 | |
209 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( | 204 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( |
210 InfoBarButton button) const { | 205 InfoBarButton button) const { |
211 return button == BUTTON_OK ? | 206 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
212 l10n_util::GetStringUTF16(IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL) : | 207 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL : |
213 l10n_util::GetStringUTF16(IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); | 208 IDS_DONT_ASK_AGAIN_INFOBAR_BUTTON_LABEL); |
214 } | 209 } |
215 | 210 |
216 bool DefaultBrowserInfoBarDelegate::NeedElevation(InfoBarButton button) const { | 211 bool DefaultBrowserInfoBarDelegate::NeedElevation(InfoBarButton button) const { |
217 return button == BUTTON_OK; | 212 return button == BUTTON_OK; |
218 } | 213 } |
219 | 214 |
220 bool DefaultBrowserInfoBarDelegate::Accept() { | 215 bool DefaultBrowserInfoBarDelegate::Accept() { |
221 action_taken_ = true; | 216 action_taken_ = true; |
222 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); | 217 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.SetAsDefault", 1); |
223 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | 218 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 return false; | 1187 return false; |
1193 automation->SetExpectedTabCount(expected_tabs); | 1188 automation->SetExpectedTabCount(expected_tabs); |
1194 | 1189 |
1195 AutomationProviderList* list = | 1190 AutomationProviderList* list = |
1196 g_browser_process->InitAutomationProviderList(); | 1191 g_browser_process->InitAutomationProviderList(); |
1197 DCHECK(list); | 1192 DCHECK(list); |
1198 list->AddProvider(automation); | 1193 list->AddProvider(automation); |
1199 | 1194 |
1200 return true; | 1195 return true; |
1201 } | 1196 } |
OLD | NEW |