| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #include "content/public/browser/notification_service.h" | 99 #include "content/public/browser/notification_service.h" |
| 100 #include "content/public/browser/notification_source.h" | 100 #include "content/public/browser/notification_source.h" |
| 101 #include "content/public/browser/notification_types.h" | 101 #include "content/public/browser/notification_types.h" |
| 102 #include "content/public/browser/url_data_source.h" | 102 #include "content/public/browser/url_data_source.h" |
| 103 #include "content/public/browser/user_metrics.h" | 103 #include "content/public/browser/user_metrics.h" |
| 104 #include "content/public/browser/web_contents.h" | 104 #include "content/public/browser/web_contents.h" |
| 105 #include "content/public/common/page_zoom.h" | 105 #include "content/public/common/page_zoom.h" |
| 106 #include "extensions/browser/extension_registry.h" | 106 #include "extensions/browser/extension_registry.h" |
| 107 #include "google_apis/gaia/gaia_auth_util.h" | 107 #include "google_apis/gaia/gaia_auth_util.h" |
| 108 #include "google_apis/gaia/google_service_auth_error.h" | 108 #include "google_apis/gaia/google_service_auth_error.h" |
| 109 #include "printing/features/features.h" |
| 109 #include "third_party/skia/include/core/SkBitmap.h" | 110 #include "third_party/skia/include/core/SkBitmap.h" |
| 110 #include "ui/base/l10n/l10n_util.h" | 111 #include "ui/base/l10n/l10n_util.h" |
| 111 #include "ui/base/webui/web_ui_util.h" | 112 #include "ui/base/webui/web_ui_util.h" |
| 112 | 113 |
| 113 #if !defined(OS_CHROMEOS) | 114 #if !defined(OS_CHROMEOS) |
| 114 #include "chrome/browser/ui/startup/default_browser_prompt.h" | 115 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
| 115 #include "chrome/browser/ui/webui/settings_utils.h" | 116 #include "chrome/browser/ui/webui/settings_utils.h" |
| 116 #endif | 117 #endif |
| 117 | 118 |
| 118 #if defined(OS_CHROMEOS) | 119 #if defined(OS_CHROMEOS) |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 { "cloudPrintEnableNotificationsLabel", | 566 { "cloudPrintEnableNotificationsLabel", |
| 566 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, | 567 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, |
| 567 #endif | 568 #endif |
| 568 }; | 569 }; |
| 569 | 570 |
| 570 RegisterStrings(values, resources, arraysize(resources)); | 571 RegisterStrings(values, resources, arraysize(resources)); |
| 571 RegisterTitle(values, "doNotTrackConfirmOverlay", | 572 RegisterTitle(values, "doNotTrackConfirmOverlay", |
| 572 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE); | 573 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE); |
| 573 RegisterTitle(values, "spellingConfirmOverlay", | 574 RegisterTitle(values, "spellingConfirmOverlay", |
| 574 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); | 575 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); |
| 575 #if defined(ENABLE_PRINT_PREVIEW) | 576 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 576 RegisterCloudPrintValues(values); | 577 RegisterCloudPrintValues(values); |
| 577 #endif | 578 #endif |
| 578 | 579 |
| 579 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); | 580 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); |
| 580 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); | 581 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); |
| 581 values->SetString( | 582 values->SetString( |
| 582 "defaultSearchGroupLabel", | 583 "defaultSearchGroupLabel", |
| 583 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); | 584 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); |
| 584 values->SetString("hotwordLearnMoreURL", chrome::kHotwordLearnMoreURL); | 585 values->SetString("hotwordLearnMoreURL", chrome::kHotwordLearnMoreURL); |
| 585 RegisterTitle(values, "hotwordConfirmOverlay", | 586 RegisterTitle(values, "hotwordConfirmOverlay", |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX)); | 752 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX)); |
| 752 } | 753 } |
| 753 // Format numbers to be used on the pin keyboard. | 754 // Format numbers to be used on the pin keyboard. |
| 754 for (int j = 0; j <= 9; ++j) { | 755 for (int j = 0; j <= 9; ++j) { |
| 755 values->SetString("pinKeyboard" + base::IntToString(j), | 756 values->SetString("pinKeyboard" + base::IntToString(j), |
| 756 base::FormatNumber(int64_t{j})); | 757 base::FormatNumber(int64_t{j})); |
| 757 } | 758 } |
| 758 #endif | 759 #endif |
| 759 } | 760 } |
| 760 | 761 |
| 761 #if defined(ENABLE_PRINT_PREVIEW) | 762 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 762 void BrowserOptionsHandler::RegisterCloudPrintValues( | 763 void BrowserOptionsHandler::RegisterCloudPrintValues( |
| 763 base::DictionaryValue* values) { | 764 base::DictionaryValue* values) { |
| 764 values->SetString("cloudPrintOptionLabel", | 765 values->SetString("cloudPrintOptionLabel", |
| 765 l10n_util::GetStringFUTF16( | 766 l10n_util::GetStringFUTF16( |
| 766 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 767 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
| 767 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 768 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
| 768 } | 769 } |
| 769 #endif // defined(ENABLE_PRINT_PREVIEW) | 770 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 770 | 771 |
| 771 void BrowserOptionsHandler::RegisterMessages() { | 772 void BrowserOptionsHandler::RegisterMessages() { |
| 772 web_ui()->RegisterMessageCallback( | 773 web_ui()->RegisterMessageCallback( |
| 773 "setDefaultSearchEngine", | 774 "setDefaultSearchEngine", |
| 774 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, | 775 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, |
| 775 base::Unretained(this))); | 776 base::Unretained(this))); |
| 776 web_ui()->RegisterMessageCallback( | 777 web_ui()->RegisterMessageCallback( |
| 777 "deleteProfile", | 778 "deleteProfile", |
| 778 base::Bind(&BrowserOptionsHandler::DeleteProfile, | 779 base::Bind(&BrowserOptionsHandler::DeleteProfile, |
| 779 base::Unretained(this))); | 780 base::Unretained(this))); |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 | 2232 |
| 2232 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2233 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2233 #if defined(OS_CHROMEOS) | 2234 #if defined(OS_CHROMEOS) |
| 2234 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2235 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2235 #else | 2236 #else |
| 2236 return true; | 2237 return true; |
| 2237 #endif | 2238 #endif |
| 2238 } | 2239 } |
| 2239 | 2240 |
| 2240 } // namespace options | 2241 } // namespace options |
| OLD | NEW |