| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 base::FilePath(base::ASCIIToUTF16(chrome::kInitialProfile))) { | 145 base::FilePath(base::ASCIIToUTF16(chrome::kInitialProfile))) { |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 | 148 |
| 149 int infobar_shown = | 149 int infobar_shown = |
| 150 profile->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar); | 150 profile->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar); |
| 151 const int kMaxTimesToShowInfoBar = 5; | 151 const int kMaxTimesToShowInfoBar = 5; |
| 152 if (infobar_shown >= kMaxTimesToShowInfoBar) | 152 if (infobar_shown >= kMaxTimesToShowInfoBar) |
| 153 return false; | 153 return false; |
| 154 | 154 |
| 155 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 155 const base::CommandLine& command_line = |
| 156 *base::CommandLine::ForCurrentProcess(); |
| 156 if (!command_line.HasSwitch(switches::kAutoLaunchAtStartup) && | 157 if (!command_line.HasSwitch(switches::kAutoLaunchAtStartup) && |
| 157 !first_run::IsChromeFirstRun()) { | 158 !first_run::IsChromeFirstRun()) { |
| 158 return false; | 159 return false; |
| 159 } | 160 } |
| 160 | 161 |
| 161 content::WebContents* web_contents = | 162 content::WebContents* web_contents = |
| 162 browser->tab_strip_model()->GetActiveWebContents(); | 163 browser->tab_strip_model()->GetActiveWebContents(); |
| 163 AutolaunchInfoBarDelegate::Create( | 164 AutolaunchInfoBarDelegate::Create( |
| 164 InfoBarService::FromWebContents(web_contents), | 165 InfoBarService::FromWebContents(web_contents), |
| 165 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | 166 Profile::FromBrowserContext(web_contents->GetBrowserContext())); |
| 166 return true; | 167 return true; |
| 167 } | 168 } |
| 168 | 169 |
| 169 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 170 void RegisterAutolaunchUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 170 registry->RegisterIntegerPref( | 171 registry->RegisterIntegerPref( |
| 171 prefs::kShownAutoLaunchInfobar, 0, | 172 prefs::kShownAutoLaunchInfobar, 0, |
| 172 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 173 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace chrome | 176 } // namespace chrome |
| OLD | NEW |