| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 { "cloudPrintEnableNotificationsLabel", | 564 { "cloudPrintEnableNotificationsLabel", |
| 564 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, | 565 IDS_LOCAL_DISCOVERY_NOTIFICATIONS_ENABLE_CHECKBOX_LABEL }, |
| 565 #endif | 566 #endif |
| 566 }; | 567 }; |
| 567 | 568 |
| 568 RegisterStrings(values, resources, arraysize(resources)); | 569 RegisterStrings(values, resources, arraysize(resources)); |
| 569 RegisterTitle(values, "doNotTrackConfirmOverlay", | 570 RegisterTitle(values, "doNotTrackConfirmOverlay", |
| 570 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE); | 571 IDS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TITLE); |
| 571 RegisterTitle(values, "spellingConfirmOverlay", | 572 RegisterTitle(values, "spellingConfirmOverlay", |
| 572 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); | 573 IDS_CONTENT_CONTEXT_SPELLING_ASK_GOOGLE); |
| 573 #if defined(ENABLE_PRINT_PREVIEW) | 574 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 574 RegisterCloudPrintValues(values); | 575 RegisterCloudPrintValues(values); |
| 575 #endif | 576 #endif |
| 576 | 577 |
| 577 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); | 578 values->SetString("syncLearnMoreURL", chrome::kSyncLearnMoreURL); |
| 578 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); | 579 base::string16 omnibox_url = base::ASCIIToUTF16(chrome::kOmniboxLearnMoreURL); |
| 579 values->SetString( | 580 values->SetString( |
| 580 "defaultSearchGroupLabel", | 581 "defaultSearchGroupLabel", |
| 581 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); | 582 l10n_util::GetStringFUTF16(IDS_SEARCH_PREF_EXPLANATION, omnibox_url)); |
| 582 values->SetString("hotwordLearnMoreURL", chrome::kHotwordLearnMoreURL); | 583 values->SetString("hotwordLearnMoreURL", chrome::kHotwordLearnMoreURL); |
| 583 RegisterTitle(values, "hotwordConfirmOverlay", | 584 RegisterTitle(values, "hotwordConfirmOverlay", |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX)); | 750 l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SCREENLOCKER_CHECKBOX)); |
| 750 } | 751 } |
| 751 // Format numbers to be used on the pin keyboard. | 752 // Format numbers to be used on the pin keyboard. |
| 752 for (int j = 0; j <= 9; ++j) { | 753 for (int j = 0; j <= 9; ++j) { |
| 753 values->SetString("pinKeyboard" + base::IntToString(j), | 754 values->SetString("pinKeyboard" + base::IntToString(j), |
| 754 base::FormatNumber(int64_t{j})); | 755 base::FormatNumber(int64_t{j})); |
| 755 } | 756 } |
| 756 #endif | 757 #endif |
| 757 } | 758 } |
| 758 | 759 |
| 759 #if defined(ENABLE_PRINT_PREVIEW) | 760 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 760 void BrowserOptionsHandler::RegisterCloudPrintValues( | 761 void BrowserOptionsHandler::RegisterCloudPrintValues( |
| 761 base::DictionaryValue* values) { | 762 base::DictionaryValue* values) { |
| 762 values->SetString("cloudPrintOptionLabel", | 763 values->SetString("cloudPrintOptionLabel", |
| 763 l10n_util::GetStringFUTF16( | 764 l10n_util::GetStringFUTF16( |
| 764 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 765 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
| 765 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 766 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
| 766 } | 767 } |
| 767 #endif // defined(ENABLE_PRINT_PREVIEW) | 768 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 768 | 769 |
| 769 void BrowserOptionsHandler::RegisterMessages() { | 770 void BrowserOptionsHandler::RegisterMessages() { |
| 770 web_ui()->RegisterMessageCallback( | 771 web_ui()->RegisterMessageCallback( |
| 771 "setDefaultSearchEngine", | 772 "setDefaultSearchEngine", |
| 772 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, | 773 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, |
| 773 base::Unretained(this))); | 774 base::Unretained(this))); |
| 774 web_ui()->RegisterMessageCallback( | 775 web_ui()->RegisterMessageCallback( |
| 775 "deleteProfile", | 776 "deleteProfile", |
| 776 base::Bind(&BrowserOptionsHandler::DeleteProfile, | 777 base::Bind(&BrowserOptionsHandler::DeleteProfile, |
| 777 base::Unretained(this))); | 778 base::Unretained(this))); |
| (...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 | 2230 |
| 2230 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { | 2231 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { |
| 2231 #if defined(OS_CHROMEOS) | 2232 #if defined(OS_CHROMEOS) |
| 2232 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); | 2233 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); |
| 2233 #else | 2234 #else |
| 2234 return true; | 2235 return true; |
| 2235 #endif | 2236 #endif |
| 2236 } | 2237 } |
| 2237 | 2238 |
| 2238 } // namespace options | 2239 } // namespace options |
| OLD | NEW |