Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4913)

Unified Diff: chrome/browser/ui/webui/options2/browser_options_handler2.cc

Issue 9317002: Make the auto-launch experiment profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
}

Powered by Google App Engine
This is Rietveld 408576698