| 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/autolaunch_prompt.h" | 5 #include "chrome/browser/ui/startup/autolaunch_prompt.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 AutolaunchInfoBarDelegate(InfoBarService* infobar_service, | 48 AutolaunchInfoBarDelegate(InfoBarService* infobar_service, |
| 49 PrefService* prefs, | 49 PrefService* prefs, |
| 50 Profile* profile); | 50 Profile* profile); |
| 51 virtual ~AutolaunchInfoBarDelegate(); | 51 virtual ~AutolaunchInfoBarDelegate(); |
| 52 | 52 |
| 53 void AllowExpiry() { should_expire_ = true; } | 53 void AllowExpiry() { should_expire_ = true; } |
| 54 | 54 |
| 55 // ConfirmInfoBarDelegate: | 55 // ConfirmInfoBarDelegate: |
| 56 virtual gfx::Image* GetIcon() const OVERRIDE; | 56 virtual int GetIconID() const OVERRIDE; |
| 57 virtual string16 GetMessageText() const OVERRIDE; | 57 virtual string16 GetMessageText() const OVERRIDE; |
| 58 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 58 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 59 virtual bool Accept() OVERRIDE; | 59 virtual bool Accept() OVERRIDE; |
| 60 virtual bool Cancel() OVERRIDE; | 60 virtual bool Cancel() OVERRIDE; |
| 61 virtual bool ShouldExpireInternal( | 61 virtual bool ShouldExpireInternal( |
| 62 const content::LoadCommittedDetails& details) const OVERRIDE; | 62 const content::LoadCommittedDetails& details) const OVERRIDE; |
| 63 | 63 |
| 64 // The prefs to use. | 64 // The prefs to use. |
| 65 PrefService* prefs_; | 65 PrefService* prefs_; |
| 66 | 66 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 base::MessageLoop::current()->PostDelayedTask( | 101 base::MessageLoop::current()->PostDelayedTask( |
| 102 FROM_HERE, | 102 FROM_HERE, |
| 103 base::Bind(&AutolaunchInfoBarDelegate::AllowExpiry, | 103 base::Bind(&AutolaunchInfoBarDelegate::AllowExpiry, |
| 104 weak_factory_.GetWeakPtr()), | 104 weak_factory_.GetWeakPtr()), |
| 105 base::TimeDelta::FromSeconds(8)); | 105 base::TimeDelta::FromSeconds(8)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 AutolaunchInfoBarDelegate::~AutolaunchInfoBarDelegate() { | 108 AutolaunchInfoBarDelegate::~AutolaunchInfoBarDelegate() { |
| 109 } | 109 } |
| 110 | 110 |
| 111 gfx::Image* AutolaunchInfoBarDelegate::GetIcon() const { | 111 int AutolaunchInfoBarDelegate::GetIconID() const { |
| 112 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 112 return IDR_PRODUCT_LOGO_32; |
| 113 IDR_PRODUCT_LOGO_32); | |
| 114 } | 113 } |
| 115 | 114 |
| 116 string16 AutolaunchInfoBarDelegate::GetMessageText() const { | 115 string16 AutolaunchInfoBarDelegate::GetMessageText() const { |
| 117 return l10n_util::GetStringUTF16(IDS_AUTO_LAUNCH_INFOBAR_TEXT); | 116 return l10n_util::GetStringUTF16(IDS_AUTO_LAUNCH_INFOBAR_TEXT); |
| 118 } | 117 } |
| 119 | 118 |
| 120 string16 AutolaunchInfoBarDelegate::GetButtonLabel( | 119 string16 AutolaunchInfoBarDelegate::GetButtonLabel( |
| 121 InfoBarButton button) const { | 120 InfoBarButton button) const { |
| 122 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 121 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 123 IDS_AUTO_LAUNCH_OK : IDS_AUTO_LAUNCH_REVERT); | 122 IDS_AUTO_LAUNCH_OK : IDS_AUTO_LAUNCH_REVERT); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } | 182 } |
| 184 | 183 |
| 185 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 184 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 186 registry->RegisterIntegerPref( | 185 registry->RegisterIntegerPref( |
| 187 prefs::kShownAutoLaunchInfobar, | 186 prefs::kShownAutoLaunchInfobar, |
| 188 0, | 187 0, |
| 189 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 188 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 190 } | 189 } |
| 191 | 190 |
| 192 } // namespace chrome | 191 } // namespace chrome |
| OLD | NEW |