Chromium Code Reviews| Index: chrome/browser/ssl/ssl_blocking_page.cc |
| diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc |
| index ca97c2b60a0a90009235bd3716fc0b3b657f2126..eff72f710d87cf920135b7b93b207662970fe079 100644 |
| --- a/chrome/browser/ssl/ssl_blocking_page.cc |
| +++ b/chrome/browser/ssl/ssl_blocking_page.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/i18n/time_formatting.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/metrics/histogram.h" |
| +#include "base/process/launch.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_piece.h" |
| #include "base/strings/stringprintf.h" |
| @@ -51,9 +52,16 @@ |
| #endif |
| #if defined(OS_WIN) |
| +#include "base/base_paths_win.h" |
| +#include "base/path_service.h" |
| #include "base/win/windows_version.h" |
| #endif |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/browser/profiles/profile_manager.h" |
| +#include "chrome/common/url_constants.h" |
| +#endif |
| + |
| using base::ASCIIToUTF16; |
| using base::TimeTicks; |
| using content::InterstitialPage; |
| @@ -216,6 +224,76 @@ void RecordSSLBlockingPageDetailedStats( |
| } |
| } |
| +void LaunchDateAndTimeSettings() { |
| +#if defined(OS_CHROMEOS) |
| + std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + |
| + l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); |
| + chrome::ShowSettingsSubPageForProfile( |
| + ProfileManager::GetActiveUserProfile(), sub_page); |
| + return; |
| +#elif defined(OS_ANDROID) |
| + CommandLine command(base::FilePath("/system/bin/am")); |
| + command.AppendArg("start"); |
| + command.AppendArg( |
| + "'com.android.settings/.Settings$DateTimeSettingsActivity'"); |
| +#elif defined(OS_IOS) |
| + // TODO(palmer) |
| + return; |
| +#elif defined(OS_LINUX) |
| + struct ClockCommand { |
| + const char* pathname; |
| + const char* argument; |
| + }; |
| + static const ClockCommand kClockCommands[] = { |
| + // GNOME |
| + // |
| + // NOTE: On old Ubuntu, naming control panels doesn't work, so it |
| + // opens the overview. This will have to be good enough. |
| + { "/usr/bin/gnome-control-center", "datetime" }, |
| + { "/usr/local/bin/gnome-control-center", "datetime" }, |
| + { "/opt/bin/gnome-control-center", "datetime" }, |
| + // KDE |
| + { "/usr/bin/kcmshell4", "clock" }, |
| + { "/usr/local/bin/kcmshell4", "clock" }, |
| + { "/opt/bin/kcmshell4", "clock" }, |
| + }; |
| + |
| + CommandLine command(base::FilePath("")); |
| + for (size_t i = 0; i < arraysize(kClockCommands); ++i) { |
| + base::FilePath pathname(kClockCommands[i].pathname); |
| + if (base::PathExists(pathname)) { |
| + command.SetProgram(pathname); |
| + command.AppendArg(kClockCommands[i].argument); |
| + break; |
| + } |
| + } |
| + if (command.GetProgram().empty()) { |
| + // Alas, there is nothing we can do. |
| + return; |
| + } |
| +#elif defined(OS_MACOSX) |
| + CommandLine command(base::FilePath("/usr/bin/open")); |
| + command.AppendArg("/System/Library/PreferencePanes/DateAndTime.prefPane"); |
| +#elif defined(OS_WIN) |
| + base::FilePath path; |
| + PathService::Get(base::DIR_SYSTEM, &path); |
| + path = path.Append(std::wstring(L"control.exe")); |
| + CommandLine command(path); |
| + command.AppendArg(std::string("/name")); |
| + command.AppendArg(std::string("Microsoft.DateAndTime")); |
| +#else |
| + return; |
| +#endif |
| + |
| + VLOG(1) << "Running " << command.GetCommandLineString(); |
|
felt
2014/07/17 22:26:07
was this VLOG for testing or meant to stay?
palmer
2014/07/18 01:23:21
I'll whack it, it isn't necessary.
|
| + base::LaunchOptions options; |
| + options.wait = false; |
| +#if defined(OS_LINUX) |
| + options.allow_new_privs = true; |
| +#endif |
| + base::LaunchProcess(command, options, NULL); |
| +} |
| + |
| } // namespace |
| // Note that we always create a navigation entry with SSL errors. |
| @@ -611,9 +689,7 @@ void SSLBlockingPage::CommandReceived(const std::string& command) { |
| break; |
| } |
| case CMD_CLOCK: { |
| - content::NavigationController::LoadURLParams help_page_params(GURL( |
| - "https://support.google.com/chrome/?p=ui_system_clock")); |
| - web_contents_->GetController().LoadURLWithParams(help_page_params); |
| + LaunchDateAndTimeSettings(); |
| break; |
| } |
| default: { |