| 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/ui/startup/default_browser_prompt.h" | 5 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 6 | 6 |
| 7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 DefaultBrowserInfoBarDelegate(InfoBarService* infobar_service, | 69 DefaultBrowserInfoBarDelegate(InfoBarService* infobar_service, |
| 70 PrefService* prefs, | 70 PrefService* prefs, |
| 71 bool interactive_flow_required); | 71 bool interactive_flow_required); |
| 72 virtual ~DefaultBrowserInfoBarDelegate(); | 72 virtual ~DefaultBrowserInfoBarDelegate(); |
| 73 | 73 |
| 74 void AllowExpiry() { should_expire_ = true; } | 74 void AllowExpiry() { should_expire_ = true; } |
| 75 | 75 |
| 76 // ConfirmInfoBarDelegate: | 76 // ConfirmInfoBarDelegate: |
| 77 virtual gfx::Image* GetIcon() const OVERRIDE; | 77 virtual int GetIconID() const OVERRIDE; |
| 78 virtual string16 GetMessageText() const OVERRIDE; | 78 virtual string16 GetMessageText() const OVERRIDE; |
| 79 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 79 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 80 virtual bool NeedElevation(InfoBarButton button) const OVERRIDE; | 80 virtual bool NeedElevation(InfoBarButton button) const OVERRIDE; |
| 81 virtual bool Accept() OVERRIDE; | 81 virtual bool Accept() OVERRIDE; |
| 82 virtual bool Cancel() OVERRIDE; | 82 virtual bool Cancel() OVERRIDE; |
| 83 virtual bool ShouldExpireInternal( | 83 virtual bool ShouldExpireInternal( |
| 84 const content::LoadCommittedDetails& details) const OVERRIDE; | 84 const content::LoadCommittedDetails& details) const OVERRIDE; |
| 85 | 85 |
| 86 // The prefs to use. | 86 // The prefs to use. |
| 87 PrefService* prefs_; | 87 PrefService* prefs_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, | 128 base::Bind(&DefaultBrowserInfoBarDelegate::AllowExpiry, |
| 129 weak_factory_.GetWeakPtr()), | 129 weak_factory_.GetWeakPtr()), |
| 130 base::TimeDelta::FromSeconds(8)); | 130 base::TimeDelta::FromSeconds(8)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { | 133 DefaultBrowserInfoBarDelegate::~DefaultBrowserInfoBarDelegate() { |
| 134 if (!action_taken_) | 134 if (!action_taken_) |
| 135 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); | 135 UMA_HISTOGRAM_COUNTS("DefaultBrowserWarning.Ignored", 1); |
| 136 } | 136 } |
| 137 | 137 |
| 138 gfx::Image* DefaultBrowserInfoBarDelegate::GetIcon() const { | 138 int DefaultBrowserInfoBarDelegate::GetIconID() const { |
| 139 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 139 return IDR_PRODUCT_LOGO_32; |
| 140 IDR_PRODUCT_LOGO_32); | |
| 141 } | 140 } |
| 142 | 141 |
| 143 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { | 142 string16 DefaultBrowserInfoBarDelegate::GetMessageText() const { |
| 144 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); | 143 return l10n_util::GetStringUTF16(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); |
| 145 } | 144 } |
| 146 | 145 |
| 147 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( | 146 string16 DefaultBrowserInfoBarDelegate::GetButtonLabel( |
| 148 InfoBarButton button) const { | 147 InfoBarButton button) const { |
| 149 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 148 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 150 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL : | 149 IDS_SET_AS_DEFAULT_INFOBAR_BUTTON_LABEL : |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 263 |
| 265 } | 264 } |
| 266 | 265 |
| 267 #if !defined(OS_WIN) | 266 #if !defined(OS_WIN) |
| 268 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { | 267 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { |
| 269 return false; | 268 return false; |
| 270 } | 269 } |
| 271 #endif | 270 #endif |
| 272 | 271 |
| 273 } // namespace chrome | 272 } // namespace chrome |
| OLD | NEW |