| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void BrowserOptionsHandler::CheckAutoLaunch( | 180 void BrowserOptionsHandler::CheckAutoLaunch( |
| 181 base::WeakPtr<BrowserOptionsHandler> weak_this) { | 181 base::WeakPtr<BrowserOptionsHandler> weak_this) { |
| 182 #if defined(OS_WIN) | 182 #if defined(OS_WIN) |
| 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 183 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 184 | 184 |
| 185 // Pass in weak pointer to this to avoid race if BrowserOptionsHandler is | 185 // Pass in weak pointer to this to avoid race if BrowserOptionsHandler is |
| 186 // deleted. | 186 // deleted. |
| 187 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 187 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 188 base::Bind(&BrowserOptionsHandler::CheckAutoLaunchCallback, | 188 base::Bind(&BrowserOptionsHandler::CheckAutoLaunchCallback, |
| 189 weak_this, | 189 weak_this, |
| 190 auto_launch_trial::IsInAutoLaunchGroup(), | 190 auto_launch_trial::IsInAutoLaunchFieldTrial(), |
| 191 auto_launch_util::WillLaunchAtLogin(FilePath()))); | 191 auto_launch_util::WillLaunchAtLogin(FilePath()))); |
| 192 #endif | 192 #endif |
| 193 } | 193 } |
| 194 | 194 |
| 195 void BrowserOptionsHandler::CheckAutoLaunchCallback( | 195 void BrowserOptionsHandler::CheckAutoLaunchCallback( |
| 196 bool is_in_auto_launch_group, | 196 bool is_in_auto_launch_group, |
| 197 bool will_launch_at_login) { | 197 bool will_launch_at_login) { |
| 198 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
| 199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 200 | 200 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 void BrowserOptionsHandler::EnableInstant(const ListValue* args) { | 512 void BrowserOptionsHandler::EnableInstant(const ListValue* args) { |
| 513 InstantController::Enable(Profile::FromWebUI(web_ui_)); | 513 InstantController::Enable(Profile::FromWebUI(web_ui_)); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void BrowserOptionsHandler::DisableInstant(const ListValue* args) { | 516 void BrowserOptionsHandler::DisableInstant(const ListValue* args) { |
| 517 InstantController::Disable(Profile::FromWebUI(web_ui_)); | 517 InstantController::Disable(Profile::FromWebUI(web_ui_)); |
| 518 } | 518 } |
| 519 | 519 |
| 520 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { | 520 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { |
| 521 #if defined(OS_WIN) | 521 #if defined(OS_WIN) |
| 522 if (!auto_launch_trial::IsInAutoLaunchGroup()) | 522 if (!auto_launch_trial::IsInAutoLaunchFieldTrial()) |
| 523 return; | 523 return; |
| 524 | 524 |
| 525 bool enable; | 525 bool enable; |
| 526 CHECK_EQ(args->GetSize(), 1U); | 526 CHECK_EQ(args->GetSize(), 1U); |
| 527 CHECK(args->GetBoolean(0, &enable)); | 527 CHECK(args->GetBoolean(0, &enable)); |
| 528 | 528 |
| 529 // Make sure we keep track of how many disable and how many enable. | 529 // Make sure we keep track of how many disable and how many enable. |
| 530 auto_launch_trial::UpdateToggleAutoLaunchMetric(enable); | 530 auto_launch_trial::UpdateToggleAutoLaunchMetric(enable); |
| 531 content::BrowserThread::PostTask( | 531 content::BrowserThread::PostTask( |
| 532 content::BrowserThread::FILE, FROM_HERE, | 532 content::BrowserThread::FILE, FROM_HERE, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 558 DictionaryValue* entry = new DictionaryValue(); | 558 DictionaryValue* entry = new DictionaryValue(); |
| 559 entry->SetString("title", match.description); | 559 entry->SetString("title", match.description); |
| 560 entry->SetString("displayURL", match.contents); | 560 entry->SetString("displayURL", match.contents); |
| 561 entry->SetString("url", match.destination_url.spec()); | 561 entry->SetString("url", match.destination_url.spec()); |
| 562 suggestions.Append(entry); | 562 suggestions.Append(entry); |
| 563 } | 563 } |
| 564 | 564 |
| 565 web_ui_->CallJavascriptFunction( | 565 web_ui_->CallJavascriptFunction( |
| 566 "BrowserOptions.updateAutocompleteSuggestions", suggestions); | 566 "BrowserOptions.updateAutocompleteSuggestions", suggestions); |
| 567 } | 567 } |
| OLD | NEW |