| 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_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/browser_options_handler2.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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 535 |
| 536 void BrowserOptionsHandler::OnStateChanged() { | 536 void BrowserOptionsHandler::OnStateChanged() { |
| 537 scoped_ptr<DictionaryValue> value(GetSyncStateDictionary()); | 537 scoped_ptr<DictionaryValue> value(GetSyncStateDictionary()); |
| 538 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", *value); | 538 web_ui()->CallJavascriptFunction("BrowserOptions.updateSyncState", *value); |
| 539 | 539 |
| 540 SendProfilesInfo(); | 540 SendProfilesInfo(); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void BrowserOptionsHandler::InitializeHandler() { | 543 void BrowserOptionsHandler::InitializeHandler() { |
| 544 Profile* profile = Profile::FromWebUI(web_ui()); | 544 Profile* profile = Profile::FromWebUI(web_ui()); |
| 545 |
| 546 // Create our favicon data source. |
| 547 profile->GetChromeURLDataManager()->AddDataSource( |
| 548 new FaviconSource(profile, FaviconSource::FAVICON)); |
| 549 } |
| 550 |
| 551 void BrowserOptionsHandler::InitializePage() { |
| 552 Profile* profile = Profile::FromWebUI(web_ui()); |
| 545 PrefService* prefs = profile->GetPrefs(); | 553 PrefService* prefs = profile->GetPrefs(); |
| 546 | 554 |
| 547 ProfileSyncService* sync_service( | 555 ProfileSyncService* sync_service( |
| 548 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); | 556 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); |
| 549 if (sync_service) | 557 if (sync_service) |
| 550 sync_service->AddObserver(this); | 558 sync_service->AddObserver(this); |
| 551 OnStateChanged(); | |
| 552 | |
| 553 // Create our favicon data source. | |
| 554 profile->GetChromeURLDataManager()->AddDataSource( | |
| 555 new FaviconSource(profile, FaviconSource::FAVICON)); | |
| 556 | 559 |
| 557 default_browser_policy_.Init(prefs::kDefaultBrowserSettingEnabled, | 560 default_browser_policy_.Init(prefs::kDefaultBrowserSettingEnabled, |
| 558 g_browser_process->local_state(), | 561 g_browser_process->local_state(), |
| 559 this); | 562 this); |
| 560 UpdateDefaultBrowserState(); | 563 UpdateDefaultBrowserState(); |
| 561 | 564 |
| 562 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, | 565 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
| 563 content::NotificationService::AllSources()); | 566 content::NotificationService::AllSources()); |
| 564 #if defined(OS_CHROMEOS) | 567 #if defined(OS_CHROMEOS) |
| 565 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 568 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 g_browser_process->local_state(), this); | 603 g_browser_process->local_state(), this); |
| 601 #endif | 604 #endif |
| 602 | 605 |
| 603 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); | 606 auto_open_files_.Init(prefs::kDownloadExtensionsToOpen, prefs, this); |
| 604 default_font_size_.Init(prefs::kWebKitGlobalDefaultFontSize, prefs, this); | 607 default_font_size_.Init(prefs::kWebKitGlobalDefaultFontSize, prefs, this); |
| 605 default_zoom_level_.Init(prefs::kDefaultZoomLevel, prefs, this); | 608 default_zoom_level_.Init(prefs::kDefaultZoomLevel, prefs, this); |
| 606 #if !defined(OS_CHROMEOS) | 609 #if !defined(OS_CHROMEOS) |
| 607 proxy_prefs_.reset( | 610 proxy_prefs_.reset( |
| 608 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); | 611 PrefSetObserver::CreateProxyPrefSetObserver(prefs, this)); |
| 609 #endif // !defined(OS_CHROMEOS) | 612 #endif // !defined(OS_CHROMEOS) |
| 610 } | |
| 611 | 613 |
| 612 void BrowserOptionsHandler::InitializePage() { | 614 OnStateChanged(); |
| 613 OnTemplateURLServiceChanged(); | 615 OnTemplateURLServiceChanged(); |
| 614 ObserveThemeChanged(); | 616 ObserveThemeChanged(); |
| 615 | 617 |
| 616 if (multiprofile_) | 618 if (multiprofile_) |
| 617 SendProfilesInfo(); | 619 SendProfilesInfo(); |
| 618 | 620 |
| 619 SetupMetricsReportingCheckbox(); | 621 SetupMetricsReportingCheckbox(); |
| 620 SetupMetricsReportingSettingVisibility(); | 622 SetupMetricsReportingSettingVisibility(); |
| 621 SetupFontSizeSelector(); | 623 SetupFontSizeSelector(); |
| 622 SetupPageZoomSelector(); | 624 SetupPageZoomSelector(); |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 } | 1414 } |
| 1413 | 1415 |
| 1414 void BrowserOptionsHandler::SetupSSLConfigSettings() { | 1416 void BrowserOptionsHandler::SetupSSLConfigSettings() { |
| 1415 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); | 1417 base::FundamentalValue checked(rev_checking_enabled_.GetValue()); |
| 1416 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); | 1418 base::FundamentalValue disabled(rev_checking_enabled_.IsManaged()); |
| 1417 web_ui()->CallJavascriptFunction( | 1419 web_ui()->CallJavascriptFunction( |
| 1418 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); | 1420 "BrowserOptions.setCheckRevocationCheckboxState", checked, disabled); |
| 1419 } | 1421 } |
| 1420 | 1422 |
| 1421 } // namespace options2 | 1423 } // namespace options2 |
| OLD | NEW |