| 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/webui/options2/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options2/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "base/value_conversions.h" | 19 #include "base/value_conversions.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "chrome/browser/auto_launch_trial.h" | 21 #include "chrome/browser/auto_launch_trial.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/chrome_page_zoom.h" | 23 #include "chrome/browser/chrome_page_zoom.h" |
| 24 #include "chrome/browser/custom_home_pages_table_model.h" | 24 #include "chrome/browser/custom_home_pages_table_model.h" |
| 25 #include "chrome/browser/download/download_prefs.h" | 25 #include "chrome/browser/download/download_prefs.h" |
| 26 #include "chrome/browser/instant/instant_controller.h" | |
| 27 #include "chrome/browser/net/url_fixer_upper.h" | 26 #include "chrome/browser/net/url_fixer_upper.h" |
| 28 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/prefs/session_startup_pref.h" | 28 #include "chrome/browser/prefs/session_startup_pref.h" |
| 30 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 29 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 31 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 30 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 32 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 31 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
| 33 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 32 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/profiles/profile_info_cache.h" | 34 #include "chrome/browser/profiles/profile_info_cache.h" |
| 36 #include "chrome/browser/profiles/profile_info_util.h" | 35 #include "chrome/browser/profiles/profile_info_util.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 void BrowserOptionsHandler::RegisterMessages() { | 425 void BrowserOptionsHandler::RegisterMessages() { |
| 427 web_ui()->RegisterMessageCallback( | 426 web_ui()->RegisterMessageCallback( |
| 428 "becomeDefaultBrowser", | 427 "becomeDefaultBrowser", |
| 429 base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser, | 428 base::Bind(&BrowserOptionsHandler::BecomeDefaultBrowser, |
| 430 base::Unretained(this))); | 429 base::Unretained(this))); |
| 431 web_ui()->RegisterMessageCallback( | 430 web_ui()->RegisterMessageCallback( |
| 432 "setDefaultSearchEngine", | 431 "setDefaultSearchEngine", |
| 433 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, | 432 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, |
| 434 base::Unretained(this))); | 433 base::Unretained(this))); |
| 435 web_ui()->RegisterMessageCallback( | 434 web_ui()->RegisterMessageCallback( |
| 436 "enableInstant", | |
| 437 base::Bind(&BrowserOptionsHandler::EnableInstant, | |
| 438 base::Unretained(this))); | |
| 439 web_ui()->RegisterMessageCallback( | |
| 440 "disableInstant", | |
| 441 base::Bind(&BrowserOptionsHandler::DisableInstant, | |
| 442 base::Unretained(this))); | |
| 443 web_ui()->RegisterMessageCallback( | |
| 444 "createProfile", | 435 "createProfile", |
| 445 base::Bind(&BrowserOptionsHandler::CreateProfile, | 436 base::Bind(&BrowserOptionsHandler::CreateProfile, |
| 446 base::Unretained(this))); | 437 base::Unretained(this))); |
| 447 web_ui()->RegisterMessageCallback( | 438 web_ui()->RegisterMessageCallback( |
| 448 "createProfileInfo", | 439 "createProfileInfo", |
| 449 base::Bind(&BrowserOptionsHandler::CreateProfileInfo, | 440 base::Bind(&BrowserOptionsHandler::CreateProfileInfo, |
| 450 base::Unretained(this))); | 441 base::Unretained(this))); |
| 451 web_ui()->RegisterMessageCallback( | 442 web_ui()->RegisterMessageCallback( |
| 452 "themesReset", | 443 "themesReset", |
| 453 base::Bind(&BrowserOptionsHandler::ThemesReset, | 444 base::Bind(&BrowserOptionsHandler::ThemesReset, |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 NOTREACHED(); | 863 NOTREACHED(); |
| 873 } | 864 } |
| 874 } else if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) { | 865 } else if (type == chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED) { |
| 875 if (multiprofile_) | 866 if (multiprofile_) |
| 876 SendProfilesInfo(); | 867 SendProfilesInfo(); |
| 877 } else { | 868 } else { |
| 878 NOTREACHED(); | 869 NOTREACHED(); |
| 879 } | 870 } |
| 880 } | 871 } |
| 881 | 872 |
| 882 void BrowserOptionsHandler::EnableInstant(const ListValue* args) { | |
| 883 InstantController::Enable(Profile::FromWebUI(web_ui())); | |
| 884 } | |
| 885 | |
| 886 void BrowserOptionsHandler::DisableInstant(const ListValue* args) { | |
| 887 InstantController::Disable(Profile::FromWebUI(web_ui())); | |
| 888 } | |
| 889 | |
| 890 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { | 873 void BrowserOptionsHandler::ToggleAutoLaunch(const ListValue* args) { |
| 891 #if defined(OS_WIN) | 874 #if defined(OS_WIN) |
| 892 if (!auto_launch_trial::IsInAutoLaunchGroup()) | 875 if (!auto_launch_trial::IsInAutoLaunchGroup()) |
| 893 return; | 876 return; |
| 894 | 877 |
| 895 bool enable; | 878 bool enable; |
| 896 CHECK_EQ(args->GetSize(), 1U); | 879 CHECK_EQ(args->GetSize(), 1U); |
| 897 CHECK(args->GetBoolean(0, &enable)); | 880 CHECK(args->GetBoolean(0, &enable)); |
| 898 | 881 |
| 899 // Make sure we keep track of how many disable and how many enable. | 882 // Make sure we keep track of how many disable and how many enable. |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 } | 1433 } |
| 1451 | 1434 |
| 1452 void BrowserOptionsHandler::SetupSSLConfigSettings() { | 1435 void BrowserOptionsHandler::SetupSSLConfigSettings() { |
| 1453 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); | 1436 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); |
| 1454 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); | 1437 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); |
| 1455 web_ui()->CallJavascriptFunction( | 1438 web_ui()->CallJavascriptFunction( |
| 1456 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); | 1439 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); |
| 1457 } | 1440 } |
| 1458 | 1441 |
| 1459 } // namespace options2 | 1442 } // namespace options2 |
| OLD | NEW |