| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // The delegate for the infobar shown when Chrome is auto-launched. | 36 // The delegate for the infobar shown when Chrome is auto-launched. |
| 37 class AutolaunchInfoBarDelegate : public ConfirmInfoBarDelegate { | 37 class AutolaunchInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 38 public: | 38 public: |
| 39 // Creates an autolaunch infobar and delegate and adds the infobar to | 39 // Creates an autolaunch infobar and delegate and adds the infobar to |
| 40 // |infobar_service|. | 40 // |infobar_service|. |
| 41 static void Create(InfoBarService* infobar_service, Profile* profile); | 41 static void Create(InfoBarService* infobar_service, Profile* profile); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 explicit AutolaunchInfoBarDelegate(Profile* profile); | 44 explicit AutolaunchInfoBarDelegate(Profile* profile); |
| 45 virtual ~AutolaunchInfoBarDelegate(); | 45 ~AutolaunchInfoBarDelegate() override; |
| 46 | 46 |
| 47 void set_should_expire() { should_expire_ = true; } | 47 void set_should_expire() { should_expire_ = true; } |
| 48 | 48 |
| 49 // ConfirmInfoBarDelegate: | 49 // ConfirmInfoBarDelegate: |
| 50 virtual int GetIconID() const override; | 50 int GetIconID() const override; |
| 51 virtual bool ShouldExpireInternal( | 51 bool ShouldExpireInternal(const NavigationDetails& details) const override; |
| 52 const NavigationDetails& details) const override; | 52 base::string16 GetMessageText() const override; |
| 53 virtual base::string16 GetMessageText() const override; | 53 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 54 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; | 54 bool Accept() override; |
| 55 virtual bool Accept() override; | 55 bool Cancel() override; |
| 56 virtual bool Cancel() override; | |
| 57 | 56 |
| 58 // Weak pointer to the profile, not owned by us. | 57 // Weak pointer to the profile, not owned by us. |
| 59 Profile* profile_; | 58 Profile* profile_; |
| 60 | 59 |
| 61 // Whether the info-bar should be dismissed on the next navigation. | 60 // Whether the info-bar should be dismissed on the next navigation. |
| 62 bool should_expire_; | 61 bool should_expire_; |
| 63 | 62 |
| 64 // Used to delay the expiration of the info-bar. | 63 // Used to delay the expiration of the info-bar. |
| 65 base::WeakPtrFactory<AutolaunchInfoBarDelegate> weak_factory_; | 64 base::WeakPtrFactory<AutolaunchInfoBarDelegate> weak_factory_; |
| 66 | 65 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return true; | 166 return true; |
| 168 } | 167 } |
| 169 | 168 |
| 170 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 169 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 171 registry->RegisterIntegerPref( | 170 registry->RegisterIntegerPref( |
| 172 prefs::kShownAutoLaunchInfobar, 0, | 171 prefs::kShownAutoLaunchInfobar, 0, |
| 173 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 172 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 174 } | 173 } |
| 175 | 174 |
| 176 } // namespace chrome | 175 } // namespace chrome |
| OLD | NEW |