| Index: chrome/browser/ui/webui/options2/browser_options_handler2.cc
|
| ===================================================================
|
| --- chrome/browser/ui/webui/options2/browser_options_handler2.cc (revision 119922)
|
| +++ chrome/browser/ui/webui/options2/browser_options_handler2.cc (working copy)
|
| @@ -41,6 +41,7 @@
|
| #include "chrome/browser/themes/theme_service_factory.h"
|
| #include "chrome/browser/ui/webui/favicon_source.h"
|
| #include "chrome/browser/ui/webui/web_ui_util.h"
|
| +#include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_switches.h"
|
| @@ -410,23 +411,30 @@
|
| BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
|
| base::Bind(&BrowserOptionsHandler::CheckAutoLaunch,
|
| weak_ptr_factory_for_ui_.GetWeakPtr(),
|
| - weak_ptr_factory_for_file_.GetWeakPtr()));
|
| + weak_ptr_factory_for_file_.GetWeakPtr(),
|
| + profile->GetPath()));
|
| weak_ptr_factory_for_ui_.DetachFromThread();
|
| #endif
|
| }
|
|
|
| void BrowserOptionsHandler::CheckAutoLaunch(
|
| - base::WeakPtr<BrowserOptionsHandler> weak_this) {
|
| + base::WeakPtr<BrowserOptionsHandler> weak_this,
|
| + const FilePath& profile_path) {
|
| #if defined(OS_WIN)
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
|
|
| + // We don't support this for secondary profiles yet.
|
| + if (profile_path.BaseName().value() != ASCIIToUTF16(chrome::kInitialProfile))
|
| + return;
|
| +
|
| // Pass in weak pointer to this to avoid race if BrowserOptionsHandler is
|
| // deleted.
|
| BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
|
| base::Bind(&BrowserOptionsHandler::CheckAutoLaunchCallback,
|
| weak_this,
|
| auto_launch_trial::IsInAutoLaunchGroup(),
|
| - auto_launch_util::WillLaunchAtLogin(FilePath())));
|
| + auto_launch_util::WillLaunchAtLogin(FilePath(),
|
| + profile_path)));
|
| #endif
|
| }
|
|
|
| @@ -443,7 +451,7 @@
|
|
|
| base::FundamentalValue enabled(will_launch_at_login);
|
| web_ui()->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState",
|
| - enabled);
|
| + enabled);
|
| }
|
| #endif
|
| }
|
| @@ -669,9 +677,11 @@
|
|
|
| // Make sure we keep track of how many disable and how many enable.
|
| auto_launch_trial::UpdateToggleAutoLaunchMetric(enable);
|
| + Profile* profile = Profile::FromWebUI(web_ui());
|
| content::BrowserThread::PostTask(
|
| content::BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&auto_launch_util::SetWillLaunchAtLogin, enable, FilePath()));
|
| + base::Bind(&auto_launch_util::SetWillLaunchAtLogin, enable,
|
| + FilePath(), profile->GetPath()));
|
| #endif // OS_WIN
|
| }
|
|
|
|
|