| 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/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/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" |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 base::Unretained(this))); | 651 base::Unretained(this))); |
| 652 #else | 652 #else |
| 653 web_ui()->RegisterMessageCallback( | 653 web_ui()->RegisterMessageCallback( |
| 654 "restartBrowser", | 654 "restartBrowser", |
| 655 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, | 655 base::Bind(&BrowserOptionsHandler::HandleRestartBrowser, |
| 656 base::Unretained(this))); | 656 base::Unretained(this))); |
| 657 #endif | 657 #endif |
| 658 } | 658 } |
| 659 | 659 |
| 660 void BrowserOptionsHandler::OnStateChanged() { | 660 void BrowserOptionsHandler::OnStateChanged() { |
| 661 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | 661 UpdateSyncState(); |
| 662 *GetSyncStateDictionary()); | |
| 663 | |
| 664 SendProfilesInfo(); | |
| 665 } | |
| 666 | |
| 667 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { | |
| 668 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", | |
| 669 *GetSyncStateDictionary()); | |
| 670 | |
| 671 SendProfilesInfo(); | |
| 672 } | 662 } |
| 673 | 663 |
| 674 void BrowserOptionsHandler::PageLoadStarted() { | 664 void BrowserOptionsHandler::PageLoadStarted() { |
| 675 page_initialized_ = false; | 665 page_initialized_ = false; |
| 676 } | 666 } |
| 677 | 667 |
| 678 void BrowserOptionsHandler::InitializeHandler() { | 668 void BrowserOptionsHandler::InitializeHandler() { |
| 679 Profile* profile = Profile::FromWebUI(web_ui()); | 669 Profile* profile = Profile::FromWebUI(web_ui()); |
| 680 PrefService* prefs = profile->GetPrefs(); | 670 PrefService* prefs = profile->GetPrefs(); |
| 681 | 671 |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 base::FundamentalValue val(exists); | 1431 base::FundamentalValue val(exists); |
| 1442 web_ui()->CallJavascriptFunction("BrowserOptions.showTouchpadControls", val); | 1432 web_ui()->CallJavascriptFunction("BrowserOptions.showTouchpadControls", val); |
| 1443 } | 1433 } |
| 1444 | 1434 |
| 1445 void BrowserOptionsHandler::MouseExists(bool exists) { | 1435 void BrowserOptionsHandler::MouseExists(bool exists) { |
| 1446 base::FundamentalValue val(exists); | 1436 base::FundamentalValue val(exists); |
| 1447 web_ui()->CallJavascriptFunction("BrowserOptions.showMouseControls", val); | 1437 web_ui()->CallJavascriptFunction("BrowserOptions.showMouseControls", val); |
| 1448 } | 1438 } |
| 1449 #endif | 1439 #endif |
| 1450 | 1440 |
| 1441 void BrowserOptionsHandler::UpdateSyncState() { |
| 1442 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", |
| 1443 *GetSyncStateDictionary()); |
| 1444 } |
| 1445 |
| 1446 void BrowserOptionsHandler::OnSigninAllowedPrefChange() { |
| 1447 UpdateSyncState(); |
| 1448 } |
| 1449 |
| 1451 void BrowserOptionsHandler::HandleAutoOpenButton(const ListValue* args) { | 1450 void BrowserOptionsHandler::HandleAutoOpenButton(const ListValue* args) { |
| 1452 content::RecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); | 1451 content::RecordAction(UserMetricsAction("Options_ResetAutoOpenFiles")); |
| 1453 DownloadManager* manager = BrowserContext::GetDownloadManager( | 1452 DownloadManager* manager = BrowserContext::GetDownloadManager( |
| 1454 web_ui()->GetWebContents()->GetBrowserContext()); | 1453 web_ui()->GetWebContents()->GetBrowserContext()); |
| 1455 if (manager) | 1454 if (manager) |
| 1456 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); | 1455 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); |
| 1457 } | 1456 } |
| 1458 | 1457 |
| 1459 void BrowserOptionsHandler::HandleDefaultFontSize(const ListValue* args) { | 1458 void BrowserOptionsHandler::HandleDefaultFontSize(const ListValue* args) { |
| 1460 int font_size; | 1459 int font_size; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 base::FundamentalValue disabled(proxy_config && | 1726 base::FundamentalValue disabled(proxy_config && |
| 1728 !proxy_config->IsUserModifiable()); | 1727 !proxy_config->IsUserModifiable()); |
| 1729 base::FundamentalValue extension_controlled(is_extension_controlled); | 1728 base::FundamentalValue extension_controlled(is_extension_controlled); |
| 1730 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1729 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
| 1731 disabled, extension_controlled); | 1730 disabled, extension_controlled); |
| 1732 | 1731 |
| 1733 #endif // !defined(OS_CHROMEOS) | 1732 #endif // !defined(OS_CHROMEOS) |
| 1734 } | 1733 } |
| 1735 | 1734 |
| 1736 } // namespace options | 1735 } // namespace options |
| OLD | NEW |