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

Unified Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 9317002: Make the auto-launch experiment profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressed Miranda's comments, for realz this time 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/options/browser_options_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/browser_options_handler.cc (revision 120769)
+++ chrome/browser/ui/webui/options/browser_options_handler.cc (working copy)
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/command_line.h"
#include "base/memory/singleton.h"
#include "base/path_service.h"
#include "base/string_number_conversions.h"
@@ -28,7 +29,9 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/webui/favicon_source.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -170,26 +173,38 @@
autocomplete_controller_.reset(new AutocompleteController(profile, this));
#if defined(OS_WIN)
- 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_ui_.DetachFromThread();
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (!command_line.HasSwitch(switches::kChromeFrame) &&
+ !command_line.HasSwitch(switches::kUserDataDir)) {
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ base::Bind(&BrowserOptionsHandler::CheckAutoLaunch,
+ weak_ptr_factory_for_ui_.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));
+ // Auto-launch is not supported 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.BaseName().value())));
#endif
}
@@ -206,7 +221,7 @@
base::FundamentalValue enabled(will_launch_at_login);
web_ui()->CallJavascriptFunction("BrowserOptions.updateAutoLaunchState",
- enabled);
+ enabled);
}
#endif
}
@@ -530,9 +545,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().BaseName().value()));
#endif // OS_WIN
}
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.h ('k') | chrome/browser/ui/webui/options2/browser_options_handler2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698