| 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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 virtual ~AutolaunchInfoBarDelegate(); | 46 virtual ~AutolaunchInfoBarDelegate(); |
| 47 | 47 |
| 48 void set_should_expire() { should_expire_ = true; } | 48 void set_should_expire() { should_expire_ = true; } |
| 49 | 49 |
| 50 // ConfirmInfoBarDelegate: | 50 // ConfirmInfoBarDelegate: |
| 51 virtual int GetIconID() const OVERRIDE; | 51 virtual int GetIconID() const OVERRIDE; |
| 52 virtual base::string16 GetMessageText() const OVERRIDE; | 52 virtual base::string16 GetMessageText() const OVERRIDE; |
| 53 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 53 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| 54 virtual bool Accept() OVERRIDE; | 54 virtual bool Accept() OVERRIDE; |
| 55 virtual bool Cancel() OVERRIDE; | 55 virtual bool Cancel() OVERRIDE; |
| 56 virtual bool ShouldExpireInternal( | 56 virtual bool ShouldExpireInternal(const NavigationDetails& details) const |
| 57 const content::LoadCommittedDetails& details) const OVERRIDE; | 57 OVERRIDE; |
| 58 | 58 |
| 59 // Weak pointer to the profile, not owned by us. | 59 // Weak pointer to the profile, not owned by us. |
| 60 Profile* profile_; | 60 Profile* profile_; |
| 61 | 61 |
| 62 // Whether the info-bar should be dismissed on the next navigation. | 62 // Whether the info-bar should be dismissed on the next navigation. |
| 63 bool should_expire_; | 63 bool should_expire_; |
| 64 | 64 |
| 65 // Used to delay the expiration of the info-bar. | 65 // Used to delay the expiration of the info-bar. |
| 66 base::WeakPtrFactory<AutolaunchInfoBarDelegate> weak_factory_; | 66 base::WeakPtrFactory<AutolaunchInfoBarDelegate> weak_factory_; |
| 67 | 67 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 bool AutolaunchInfoBarDelegate::Cancel() { | 119 bool AutolaunchInfoBarDelegate::Cancel() { |
| 120 content::BrowserThread::PostTask( | 120 content::BrowserThread::PostTask( |
| 121 content::BrowserThread::FILE, FROM_HERE, | 121 content::BrowserThread::FILE, FROM_HERE, |
| 122 base::Bind(&auto_launch_util::DisableForegroundStartAtLogin, | 122 base::Bind(&auto_launch_util::DisableForegroundStartAtLogin, |
| 123 profile_->GetPath().BaseName().value())); | 123 profile_->GetPath().BaseName().value())); |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool AutolaunchInfoBarDelegate::ShouldExpireInternal( | 127 bool AutolaunchInfoBarDelegate::ShouldExpireInternal( |
| 128 const content::LoadCommittedDetails& details) const { | 128 const NavigationDetails& details) const { |
| 129 return should_expire_; | 129 return should_expire_; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 | 134 |
| 135 // Functions ------------------------------------------------------------------ | 135 // Functions ------------------------------------------------------------------ |
| 136 | 136 |
| 137 namespace chrome { | 137 namespace chrome { |
| 138 | 138 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 167 return true; | 167 return true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 170 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 171 registry->RegisterIntegerPref( | 171 registry->RegisterIntegerPref( |
| 172 prefs::kShownAutoLaunchInfobar, 0, | 172 prefs::kShownAutoLaunchInfobar, 0, |
| 173 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 173 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace chrome | 176 } // namespace chrome |
| OLD | NEW |