Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 195983023: Enable devices page UI on MacOSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_dcheck
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 #include "components/policy/core/common/policy_namespace.h" 118 #include "components/policy/core/common/policy_namespace.h"
119 #include "components/policy/core/common/policy_service.h" 119 #include "components/policy/core/common/policy_service.h"
120 #include "policy/policy_constants.h" 120 #include "policy/policy_constants.h"
121 #include "ui/gfx/image/image_skia.h" 121 #include "ui/gfx/image/image_skia.h"
122 #endif // defined(OS_CHROMEOS) 122 #endif // defined(OS_CHROMEOS)
123 123
124 #if defined(OS_WIN) 124 #if defined(OS_WIN)
125 #include "chrome/installer/util/auto_launch_util.h" 125 #include "chrome/installer/util/auto_launch_util.h"
126 #endif // defined(OS_WIN) 126 #endif // defined(OS_WIN)
127 127
128 #if defined(ENABLE_MDNS) 128 #if defined(ENABLE_SERVICE_DISCOVERY)
129 #include "chrome/browser/local_discovery/privet_notifications.h" 129 #include "chrome/browser/local_discovery/privet_notifications.h"
130 #endif 130 #endif
131 131
132 using base::UserMetricsAction; 132 using base::UserMetricsAction;
133 using content::BrowserContext; 133 using content::BrowserContext;
134 using content::BrowserThread; 134 using content::BrowserThread;
135 using content::DownloadManager; 135 using content::DownloadManager;
136 using content::OpenURLParams; 136 using content::OpenURLParams;
137 using content::Referrer; 137 using content::Referrer;
138 138
(...skipping 16 matching lines...) Expand all
155 cloud_print_connector_ui_enabled_ = 155 cloud_print_connector_ui_enabled_ =
156 CommandLine::ForCurrentProcess()->HasSwitch( 156 CommandLine::ForCurrentProcess()->HasSwitch(
157 switches::kEnableCloudPrintProxy); 157 switches::kEnableCloudPrintProxy);
158 #elif !defined(OS_CHROMEOS) 158 #elif !defined(OS_CHROMEOS)
159 // Always enabled for Mac, Linux and Google Chrome Windows builds. 159 // Always enabled for Mac, Linux and Google Chrome Windows builds.
160 // Never enabled for Chrome OS, we don't even need to indicate it. 160 // Never enabled for Chrome OS, we don't even need to indicate it.
161 cloud_print_connector_ui_enabled_ = true; 161 cloud_print_connector_ui_enabled_ = true;
162 #endif 162 #endif
163 #endif // defined(ENABLE_FULL_PRINTING) 163 #endif // defined(ENABLE_FULL_PRINTING)
164 164
165 #if defined(ENABLE_MDNS) 165 #if defined(ENABLE_SERVICE_DISCOVERY)
166 cloud_print_mdns_ui_enabled_ = !CommandLine::ForCurrentProcess()->HasSwitch( 166 cloud_print_mdns_ui_enabled_ = !CommandLine::ForCurrentProcess()->HasSwitch(
167 switches::kDisableDeviceDiscovery); 167 switches::kDisableDeviceDiscovery);
168 #endif // defined(ENABLE_MDNS) 168 #endif // defined(ENABLE_SERVICE_DISCOVERY)
169 } 169 }
170 170
171 BrowserOptionsHandler::~BrowserOptionsHandler() { 171 BrowserOptionsHandler::~BrowserOptionsHandler() {
172 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: 172 ProfileSyncService* sync_service(ProfileSyncServiceFactory::
173 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); 173 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
174 if (sync_service) 174 if (sync_service)
175 sync_service->RemoveObserver(this); 175 sync_service->RemoveObserver(this);
176 176
177 if (default_browser_worker_.get()) 177 if (default_browser_worker_.get())
178 default_browser_worker_->ObserverDestroyed(); 178 default_browser_worker_->ObserverDestroyed();
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN, 431 { "defaultBrowserUnknown", IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN,
432 IDS_PRODUCT_NAME }, 432 IDS_PRODUCT_NAME },
433 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT }, 433 { "defaultBrowserUseAsDefault", IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT },
434 { "autoLaunchText", IDS_AUTOLAUNCH_TEXT }, 434 { "autoLaunchText", IDS_AUTOLAUNCH_TEXT },
435 #if defined(OS_CHROMEOS) 435 #if defined(OS_CHROMEOS)
436 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION, 436 { "factoryResetDescription", IDS_OPTIONS_FACTORY_RESET_DESCRIPTION,
437 IDS_SHORT_PRODUCT_NAME }, 437 IDS_SHORT_PRODUCT_NAME },
438 #endif 438 #endif
439 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL, 439 { "languageSectionLabel", IDS_OPTIONS_ADVANCED_LANGUAGE_LABEL,
440 IDS_SHORT_PRODUCT_NAME }, 440 IDS_SHORT_PRODUCT_NAME },
441 #if defined(ENABLE_MDNS) 441 #if defined(ENABLE_SERVICE_DISCOVERY)
442 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON }, 442 { "cloudPrintDevicesPageButton", IDS_LOCAL_DISCOVERY_DEVICES_PAGE_BUTTON },
443 { "cloudPrintEnableNotificationsLabel", 443 { "cloudPrintEnableNotificationsLabel",
444 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, 444 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL },
445 #endif 445 #endif
446 }; 446 };
447 447
448 #if defined(ENABLE_SETTINGS_APP) 448 #if defined(ENABLE_SETTINGS_APP)
449 static OptionsStringResource app_resources[] = { 449 static OptionsStringResource app_resources[] = {
450 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW }, 450 { "syncOverview", IDS_SETTINGS_APP_SYNC_OVERVIEW },
451 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL, 451 { "syncButtonTextStart", IDS_SYNC_START_SYNC_BUTTON_LABEL,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 values->SetBoolean("profileIsManaged", 556 values->SetBoolean("profileIsManaged",
557 Profile::FromWebUI(web_ui())->IsManaged()); 557 Profile::FromWebUI(web_ui())->IsManaged());
558 558
559 #if !defined(OS_CHROMEOS) 559 #if !defined(OS_CHROMEOS)
560 values->SetBoolean( 560 values->SetBoolean(
561 "gpuEnabledAtStart", 561 "gpuEnabledAtStart",
562 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); 562 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
563 #endif 563 #endif
564 564
565 #if defined(ENABLE_MDNS) 565 #if defined(ENABLE_SERVICE_DISCOVERY)
566 values->SetBoolean("cloudPrintHideNotificationsCheckbox", 566 values->SetBoolean("cloudPrintHideNotificationsCheckbox",
567 !local_discovery::PrivetNotificationService::IsEnabled()); 567 !local_discovery::PrivetNotificationService::IsEnabled());
568 #endif 568 #endif
569 569
570 values->SetBoolean("cloudPrintShowMDnsOptions", 570 values->SetBoolean("cloudPrintShowMDnsOptions",
571 cloud_print_mdns_ui_enabled_); 571 cloud_print_mdns_ui_enabled_);
572 572
573 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL); 573 values->SetString("cloudPrintLearnMoreURL", chrome::kCloudPrintLearnMoreURL);
574 574
575 values->SetString("languagesLearnMoreURL", 575 values->SetString("languagesLearnMoreURL",
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 base::Bind(&BrowserOptionsHandler::HandleDisableCloudPrintConnector, 705 base::Bind(&BrowserOptionsHandler::HandleDisableCloudPrintConnector,
706 base::Unretained(this))); 706 base::Unretained(this)));
707 } 707 }
708 #endif // defined(ENABLE_FULL_PRINTING) 708 #endif // defined(ENABLE_FULL_PRINTING)
709 web_ui()->RegisterMessageCallback( 709 web_ui()->RegisterMessageCallback(
710 "showNetworkProxySettings", 710 "showNetworkProxySettings",
711 base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings, 711 base::Bind(&BrowserOptionsHandler::ShowNetworkProxySettings,
712 base::Unretained(this))); 712 base::Unretained(this)));
713 #endif // defined(OS_CHROMEOS) 713 #endif // defined(OS_CHROMEOS)
714 714
715 #if defined(ENABLE_MDNS) 715 #if defined(ENABLE_SERVICE_DISCOVERY)
716 if (cloud_print_mdns_ui_enabled_) { 716 if (cloud_print_mdns_ui_enabled_) {
717 web_ui()->RegisterMessageCallback( 717 web_ui()->RegisterMessageCallback(
718 "showCloudPrintDevicesPage", 718 "showCloudPrintDevicesPage",
719 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage, 719 base::Bind(&BrowserOptionsHandler::ShowCloudPrintDevicesPage,
720 base::Unretained(this))); 720 base::Unretained(this)));
721 } 721 }
722 #endif 722 #endif
723 web_ui()->RegisterMessageCallback( 723 web_ui()->RegisterMessageCallback(
724 "requestHotwordAvailable", 724 "requestHotwordAvailable",
725 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable, 725 base::Bind(&BrowserOptionsHandler::HandleRequestHotwordAvailable,
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 1488
1489 #if !defined(USE_NSS) && !defined(USE_OPENSSL) 1489 #if !defined(USE_NSS) && !defined(USE_OPENSSL)
1490 void BrowserOptionsHandler::ShowManageSSLCertificates( 1490 void BrowserOptionsHandler::ShowManageSSLCertificates(
1491 const base::ListValue* args) { 1491 const base::ListValue* args) {
1492 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates")); 1492 content::RecordAction(UserMetricsAction("Options_ManageSSLCertificates"));
1493 AdvancedOptionsUtilities::ShowManageSSLCertificates( 1493 AdvancedOptionsUtilities::ShowManageSSLCertificates(
1494 web_ui()->GetWebContents()); 1494 web_ui()->GetWebContents());
1495 } 1495 }
1496 #endif 1496 #endif
1497 1497
1498 #if defined(ENABLE_MDNS) 1498 #if defined(ENABLE_SERVICE_DISCOVERY)
1499 1499
1500 void BrowserOptionsHandler::ShowCloudPrintDevicesPage( 1500 void BrowserOptionsHandler::ShowCloudPrintDevicesPage(
1501 const base::ListValue* args) { 1501 const base::ListValue* args) {
1502 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage")); 1502 content::RecordAction(UserMetricsAction("Options_CloudPrintDevicesPage"));
1503 // Navigate in current tab to devices page. 1503 // Navigate in current tab to devices page.
1504 OpenURLParams params( 1504 OpenURLParams params(
1505 GURL(chrome::kChromeUIDevicesURL), Referrer(), 1505 GURL(chrome::kChromeUIDevicesURL), Referrer(),
1506 CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); 1506 CURRENT_TAB, content::PAGE_TRANSITION_LINK, false);
1507 web_ui()->GetWebContents()->OpenURL(params); 1507 web_ui()->GetWebContents()->OpenURL(params);
1508 } 1508 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 void BrowserOptionsHandler::SetupEasyUnlock() { 1802 void BrowserOptionsHandler::SetupEasyUnlock() {
1803 bool has_pairing = !Profile::FromWebUI(web_ui())->GetPrefs() 1803 bool has_pairing = !Profile::FromWebUI(web_ui())->GetPrefs()
1804 ->GetDictionary(prefs::kEasyUnlockPairing)->empty(); 1804 ->GetDictionary(prefs::kEasyUnlockPairing)->empty();
1805 base::FundamentalValue has_pairing_value(has_pairing); 1805 base::FundamentalValue has_pairing_value(has_pairing);
1806 web_ui()->CallJavascriptFunction( 1806 web_ui()->CallJavascriptFunction(
1807 "BrowserOptions.updateEasyUnlock", 1807 "BrowserOptions.updateEasyUnlock",
1808 has_pairing_value); 1808 has_pairing_value);
1809 } 1809 }
1810 1810
1811 } // namespace options 1811 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698