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 "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 #include "components/policy/core/common/policy_namespace.h" | 117 #include "components/policy/core/common/policy_namespace.h" |
118 #include "components/policy/core/common/policy_service.h" | 118 #include "components/policy/core/common/policy_service.h" |
119 #include "policy/policy_constants.h" | 119 #include "policy/policy_constants.h" |
120 #include "ui/gfx/image/image_skia.h" | 120 #include "ui/gfx/image/image_skia.h" |
121 #endif // defined(OS_CHROMEOS) | 121 #endif // defined(OS_CHROMEOS) |
122 | 122 |
123 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
124 #include "chrome/installer/util/auto_launch_util.h" | 124 #include "chrome/installer/util/auto_launch_util.h" |
125 #endif // defined(OS_WIN) | 125 #endif // defined(OS_WIN) |
126 | 126 |
127 #if defined(ENABLE_MDNS) | 127 #if defined(ENABLE_SERVICE_DISCOVERY) |
128 #include "chrome/browser/local_discovery/privet_notifications.h" | 128 #include "chrome/browser/local_discovery/privet_notifications.h" |
129 #endif | 129 #endif |
130 | 130 |
131 using base::UserMetricsAction; | 131 using base::UserMetricsAction; |
132 using content::BrowserContext; | 132 using content::BrowserContext; |
133 using content::BrowserThread; | 133 using content::BrowserThread; |
134 using content::DownloadManager; | 134 using content::DownloadManager; |
135 using content::OpenURLParams; | 135 using content::OpenURLParams; |
136 using content::Referrer; | 136 using content::Referrer; |
137 | 137 |
(...skipping 16 matching lines...) Expand all Loading... |
154 cloud_print_connector_ui_enabled_ = | 154 cloud_print_connector_ui_enabled_ = |
155 CommandLine::ForCurrentProcess()->HasSwitch( | 155 CommandLine::ForCurrentProcess()->HasSwitch( |
156 switches::kEnableCloudPrintProxy); | 156 switches::kEnableCloudPrintProxy); |
157 #elif !defined(OS_CHROMEOS) | 157 #elif !defined(OS_CHROMEOS) |
158 // Always enabled for Mac, Linux and Google Chrome Windows builds. | 158 // Always enabled for Mac, Linux and Google Chrome Windows builds. |
159 // Never enabled for Chrome OS, we don't even need to indicate it. | 159 // Never enabled for Chrome OS, we don't even need to indicate it. |
160 cloud_print_connector_ui_enabled_ = true; | 160 cloud_print_connector_ui_enabled_ = true; |
161 #endif | 161 #endif |
162 #endif // defined(ENABLE_FULL_PRINTING) | 162 #endif // defined(ENABLE_FULL_PRINTING) |
163 | 163 |
164 #if defined(ENABLE_MDNS) | 164 #if defined(ENABLE_SERVICE_DISCOVERY) |
165 cloud_print_mdns_ui_enabled_ = !CommandLine::ForCurrentProcess()->HasSwitch( | 165 cloud_print_mdns_ui_enabled_ = !CommandLine::ForCurrentProcess()->HasSwitch( |
166 switches::kDisableDeviceDiscovery); | 166 switches::kDisableDeviceDiscovery); |
167 #endif // defined(ENABLE_MDNS) | 167 #endif // defined(ENABLE_SERVICE_DISCOVERY) |
168 } | 168 } |
169 | 169 |
170 BrowserOptionsHandler::~BrowserOptionsHandler() { | 170 BrowserOptionsHandler::~BrowserOptionsHandler() { |
171 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: | 171 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: |
172 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); | 172 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); |
173 if (sync_service) | 173 if (sync_service) |
174 sync_service->RemoveObserver(this); | 174 sync_service->RemoveObserver(this); |
175 | 175 |
176 if (default_browser_worker_.get()) | 176 if (default_browser_worker_.get()) |
177 default_browser_worker_->ObserverDestroyed(); | 177 default_browser_worker_->ObserverDestroyed(); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, | 423 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, |
424 IDS_PRODUCT_NAME }, | 424 IDS_PRODUCT_NAME }, |
425 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT }, | 425 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT }, |
426 { "autoLaunchText", IDS_AUTOLAUNCH_TEXT }, | 426 { "autoLaunchText", IDS_AUTOLAUNCH_TEXT }, |
427 #if defined(OS_CHROMEOS) | 427 #if defined(OS_CHROMEOS) |
428 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, | 428 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, |
429 IDS_SHORT_PRODUCT_NAME }, | 429 IDS_SHORT_PRODUCT_NAME }, |
430 #endif | 430 #endif |
431 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, | 431 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, |
432 IDS_SHORT_PRODUCT_NAME }, | 432 IDS_SHORT_PRODUCT_NAME }, |
433 #if defined(ENABLE_MDNS) | 433 #if defined(ENABLE_SERVICE_DISCOVERY) |
434 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, | 434 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, |
435 { "cloudPrintEnableNotificationsLabel", | 435 { "cloudPrintEnableNotificationsLabel", |
436 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, | 436 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, |
437 #endif | 437 #endif |
438 }; | 438 }; |
439 | 439 |
440 #if defined(ENABLE_SETTINGS_APP) | 440 #if defined(ENABLE_SETTINGS_APP) |
441 static OptionsStringResource app_resources[] = { | 441 static OptionsStringResource app_resources[] = { |
442 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW }, | 442 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW }, |
443 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, | 443 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 547 |
548 values->SetBoolean("profileIsManaged", | 548 values->SetBoolean("profileIsManaged", |
549 Profile::FromWebUI(web_ui())->IsManaged()); | 549 Profile::FromWebUI(web_ui())->IsManaged()); |
550 | 550 |
551 #if !defined(OS_CHROMEOS) | 551 #if !defined(OS_CHROMEOS) |
552 values->SetBoolean( | 552 values->SetBoolean( |
553 "gpuEnabledAtStart", | 553 "gpuEnabledAtStart", |
554 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 554 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
555 #endif | 555 #endif |
556 | 556 |
557 #if defined(ENABLE_MDNS) | 557 #if defined(ENABLE_SERVICE_DISCOVERY) |
558 values->SetBoolean("cloudPrintHideNotificationsCheckbox", | 558 values->SetBoolean("cloudPrintHideNotificationsCheckbox", |
559 !local_discovery::PrivetNotificationService::IsEnabled()); | 559 !local_discovery::PrivetNotificationService::IsEnabled()); |
560 #endif | 560 #endif |
561 | 561 |
562 values->SetBoolean("cloudPrintShowMDnsOptions", | 562 values->SetBoolean("cloudPrintShowMDnsOptions", |
563 cloud_print_mdns_ui_enabled_); | 563 cloud_print_mdns_ui_enabled_); |
564 | 564 |
565 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); | 565 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); |
566 | 566 |
567 values->SetString("languagesLearnMoreURL", | 567 values->SetString("languagesLearnMoreURL", |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 base::Bind(&BrowserOptionsHandler::HandleDisableCloudPrintConnector, | 684 base::Bind(&BrowserOptionsHandler::HandleDisableCloudPrintConnector, |
685 base::Unretained(this))); | 685 base::Unretained(this))); |
686 } | 686 } |
687 #endif // defined(ENABLE_FULL_PRINTING) | 687 #endif // defined(ENABLE_FULL_PRINTING) |
688 web_ui()->RegisterMessageCallback( | 688 web_ui()->RegisterMessageCallback( |
689 "showNetworkProxySettings", | 689 "showNetworkProxySettings", |
690 base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings, | 690 base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings, |
691 base::Unretained(this))); | 691 base::Unretained(this))); |
692 #endif // defined(OS_CHROMEOS) | 692 #endif // defined(OS_CHROMEOS) |
693 | 693 |
694 #if defined(ENABLE_MDNS) | 694 #if defined(ENABLE_SERVICE_DISCOVERY) |
695 if (cloud_print_mdns_ui_enabled_) { | 695 if (cloud_print_mdns_ui_enabled_) { |
696 web_ui()->RegisterMessageCallback( | 696 web_ui()->RegisterMessageCallback( |
697 "showCloudPrintDevicesPage", | 697 "showCloudPrintDevicesPage", |
698 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, | 698 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, |
699 base::Unretained(this))); | 699 base::Unretained(this))); |
700 } | 700 } |
701 #endif | 701 #endif |
702 web_ui()->RegisterMessageCallback( | 702 web_ui()->RegisterMessageCallback( |
703 "requestHotwordAvailable", | 703 "requestHotwordAvailable", |
704 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, | 704 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 | 1452 |
1453 #if !defined(USE_NSS) && !defined(USE_OPENSSL) | 1453 #if !defined(USE_NSS) && !defined(USE_OPENSSL) |
1454 void BrowserOptionsHandler::ShowManageSSLCertificates( | 1454 void BrowserOptionsHandler::ShowManageSSLCertificates( |
1455 const base::ListValue* args) { | 1455 const base::ListValue* args) { |
1456 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates")); | 1456 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates")); |
1457 AdvancedOptionsUtilities::ShowManageSSLCertificates( | 1457 AdvancedOptionsUtilities::ShowManageSSLCertificates( |
1458 web_ui()->GetWebContents()); | 1458 web_ui()->GetWebContents()); |
1459 } | 1459 } |
1460 #endif | 1460 #endif |
1461 | 1461 |
1462 #if defined(ENABLE_MDNS) | 1462 #if defined(ENABLE_SERVICE_DISCOVERY) |
1463 | 1463 |
1464 void BrowserOptionsHandler::ShowCloudPrintDevicesPage( | 1464 void BrowserOptionsHandler::ShowCloudPrintDevicesPage( |
1465 const base::ListValue* args) { | 1465 const base::ListValue* args) { |
1466 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage")); | 1466 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage")); |
1467 // Navigate in current tab to devices page. | 1467 // Navigate in current tab to devices page. |
1468 OpenURLParams params( | 1468 OpenURLParams params( |
1469 GURL(chrome::kChromeUIDevicesURL), Referrer(), | 1469 GURL(chrome::kChromeUIDevicesURL), Referrer(), |
1470 CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); | 1470 CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); |
1471 web_ui()->GetWebContents()->OpenURL(params); | 1471 web_ui()->GetWebContents()->OpenURL(params); |
1472 } | 1472 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { | 1739 void BrowserOptionsHandler::SetupManagingSupervisedUsers() { |
1740 bool has_users = !Profile::FromWebUI(web_ui())-> | 1740 bool has_users = !Profile::FromWebUI(web_ui())-> |
1741 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); | 1741 GetPrefs()->GetDictionary(prefs::kManagedUsers)->empty(); |
1742 base::FundamentalValue has_users_value(has_users); | 1742 base::FundamentalValue has_users_value(has_users); |
1743 web_ui()->CallJavascriptFunction( | 1743 web_ui()->CallJavascriptFunction( |
1744 "BrowserOptions.updateManagesSupervisedUsers", | 1744 "BrowserOptions.updateManagesSupervisedUsers", |
1745 has_users_value); | 1745 has_users_value); |
1746 } | 1746 } |
1747 | 1747 |
1748 } // namespace options | 1748 } // namespace options |
OLD | NEW |