Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/interstitials/chrome_controller_client.h" | 5 #include "chrome/browser/interstitials/chrome_controller_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/process/launch.h" | 10 #include "base/process/launch.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/interstitials/chrome_metrics_helper.h" | 13 #include "chrome/browser/interstitials/chrome_metrics_helper.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 17 #include "components/safe_browsing_db/safe_browsing_prefs.h" | 17 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/interstitial_page.h" | 19 #include "content/public/browser/interstitial_page.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "content/public/common/referrer.h" | 21 #include "content/public/common/referrer.h" |
| 22 | 22 |
| 23 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 24 #include "chrome/browser/android/intent_helper.h" | 24 #include "chrome/browser/android/intent_helper.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 28 #include "base/feature_list.h" | |
| 28 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 29 #include "chrome/browser/ui/chrome_pages.h" | 30 #include "chrome/browser/ui/chrome_pages.h" |
| 31 #include "chrome/common/chrome_features.h" | |
| 30 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 31 #include "chrome/grit/generated_resources.h" | 33 #include "chrome/grit/generated_resources.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 33 #endif | 35 #endif |
| 34 | 36 |
| 35 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 36 #include "base/base_paths_win.h" | 38 #include "base/base_paths_win.h" |
| 37 #include "base/path_service.h" | 39 #include "base/path_service.h" |
| 38 #include "base/strings/string16.h" | 40 #include "base/strings/string16.h" |
| 39 #include "base/win/windows_version.h" | 41 #include "base/win/windows_version.h" |
| 40 #endif | 42 #endif |
| 41 | 43 |
| 42 using content::Referrer; | 44 using content::Referrer; |
| 43 | 45 |
| 44 namespace { | 46 namespace { |
| 45 | 47 |
| 46 void LaunchDateAndTimeSettingsOnFile() { | 48 void LaunchDateAndTimeSettingsOnFile() { |
| 47 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); | 49 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); |
| 48 // The code for each OS is completely separate, in order to avoid bugs like | 50 // The code for each OS is completely separate, in order to avoid bugs like |
| 49 // https://crbug.com/430877 . | 51 // https://crbug.com/430877 . |
| 50 #if defined(OS_ANDROID) | 52 #if defined(OS_ANDROID) |
| 51 chrome::android::OpenDateAndTimeSettings(); | 53 chrome::android::OpenDateAndTimeSettings(); |
| 52 | 54 |
| 53 #elif defined(OS_CHROMEOS) | 55 #elif defined(OS_CHROMEOS) |
| 54 std::string sub_page = | 56 std::string sub_page; |
| 55 std::string(chrome::kSearchSubPage) + "#" + | 57 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { |
| 56 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); | 58 sub_page = chrome::kDateTimeSubPage; |
| 59 } else { | |
| 60 sub_page = | |
| 61 std::string(chrome::kDeprecatedOptionsSearchSubPage) + "#" + | |
| 62 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); | |
| 63 } | |
|
stevenjb
2016/10/27 19:10:56
Optional suggestion: Just use chrome::kDateTimeSub
tommycli
2016/10/27 21:03:50
Done.
| |
| 57 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), | 64 chrome::ShowSettingsSubPageForProfile(ProfileManager::GetActiveUserProfile(), |
| 58 sub_page); | 65 sub_page); |
| 59 | 66 |
| 60 #elif defined(OS_LINUX) | 67 #elif defined(OS_LINUX) |
| 61 struct ClockCommand { | 68 struct ClockCommand { |
| 62 const char* pathname; | 69 const char* pathname; |
| 63 const char* argument; | 70 const char* argument; |
| 64 }; | 71 }; |
| 65 static const ClockCommand kClockCommands[] = { | 72 static const ClockCommand kClockCommands[] = { |
| 66 // Unity | 73 // Unity |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 | 188 |
| 182 PrefService* ChromeControllerClient::GetPrefService() { | 189 PrefService* ChromeControllerClient::GetPrefService() { |
| 183 Profile* profile = | 190 Profile* profile = |
| 184 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 191 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 185 return profile->GetPrefs(); | 192 return profile->GetPrefs(); |
| 186 } | 193 } |
| 187 | 194 |
| 188 const std::string ChromeControllerClient::GetExtendedReportingPrefName() { | 195 const std::string ChromeControllerClient::GetExtendedReportingPrefName() { |
| 189 return safe_browsing::GetExtendedReportingPrefName(*GetPrefService()); | 196 return safe_browsing::GetExtendedReportingPrefName(*GetPrefService()); |
| 190 } | 197 } |
| OLD | NEW |