Chromium Code Reviews| 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/ssl/ssl_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 6 | 6 |
| 7 #include "base/build_time.h" | 7 #include "base/build_time.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| 11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/process/launch.h" | |
| 13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/history/history_service_factory.h" | 21 #include "chrome/browser/history/history_service_factory.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/renderer_preferences_util.h" | 23 #include "chrome/browser/renderer_preferences_util.h" |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 web_contents_->GetController().Reload(true); | 605 web_contents_->GetController().Reload(true); |
| 605 break; | 606 break; |
| 606 } | 607 } |
| 607 case CMD_HELP: { | 608 case CMD_HELP: { |
| 608 content::NavigationController::LoadURLParams help_page_params(GURL( | 609 content::NavigationController::LoadURLParams help_page_params(GURL( |
| 609 "https://support.google.com/chrome/answer/4454607")); | 610 "https://support.google.com/chrome/answer/4454607")); |
| 610 web_contents_->GetController().LoadURLWithParams(help_page_params); | 611 web_contents_->GetController().LoadURLWithParams(help_page_params); |
| 611 break; | 612 break; |
| 612 } | 613 } |
| 613 case CMD_CLOCK: { | 614 case CMD_CLOCK: { |
| 614 content::NavigationController::LoadURLParams help_page_params(GURL( | 615 #if defined(OS_ANDROID) |
| 615 "https://support.google.com/chrome/?p=ui_system_clock")); | 616 CommandLine command(base::FilePath("/system/bin/am")); |
| 616 web_contents_->GetController().LoadURLWithParams(help_page_params); | 617 command.AppendArg("start"); |
| 618 command.AppendArg( | |
| 619 "'com.android.settings/.Settings$DateTimeSettingsActivity'"); | |
| 620 #elif defined(OS_CHROMEOS) | |
|
stevenjb
2014/07/16 01:11:32
Puttung all of these #ifdefs inside a case block i
palmer
2014/07/16 02:14:35
Done.
| |
| 621 // TODO(palmer) | |
| 622 break; | |
| 623 #elif defined(OS_IOS) | |
| 624 // TODO(palmer) | |
| 625 break; | |
| 626 #elif defined(OS_LINUX) | |
| 627 CommandLine command(base::FilePath("/usr/bin/gnome-control-center")); | |
| 628 // NOTE: On old Ubuntu, naming control panels doesn't work, so it | |
| 629 // opens the overview. This will have to be good enough. | |
| 630 command.AppendArg("datetime"); | |
| 631 // | |
| 632 // TODO(palmer): Provide an option for KDE, et c. | |
| 633 #elif defined(OS_MACOSX) | |
| 634 CommandLine command(base::FilePath("/usr/bin/open")); | |
| 635 command.AppendArg("/System/Library/PreferencePanes/DateAndTime.prefPane"); | |
| 636 #elif defined(OS_WIN) | |
| 637 base::FilePath path; | |
| 638 PathService::Get(base::DIR_SYSTEM, &path); | |
| 639 path = path.Append(L"control.exe"); | |
| 640 CommandLine command(path); | |
| 641 command.AppendArg(L"/name"); | |
| 642 command.AppendArg(L"Microsoft.DateAndTime"); | |
| 643 #else | |
| 644 break; | |
| 645 #endif | |
| 646 | |
| 647 VLOG(1) << "Running " << command.GetCommandLineString(); | |
| 648 base::LaunchOptions options; | |
| 649 options.wait = false; | |
| 650 base::LaunchProcess(command, options, NULL); | |
| 617 break; | 651 break; |
| 618 } | 652 } |
| 619 default: { | 653 default: { |
| 620 NOTREACHED(); | 654 NOTREACHED(); |
| 621 } | 655 } |
| 622 } | 656 } |
| 623 } | 657 } |
| 624 | 658 |
| 625 void SSLBlockingPage::OverrideRendererPrefs( | 659 void SSLBlockingPage::OverrideRendererPrefs( |
| 626 content::RendererPreferences* prefs) { | 660 content::RendererPreferences* prefs) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 // sure we don't clear the captive portal flag, since the interstitial was | 755 // sure we don't clear the captive portal flag, since the interstitial was |
| 722 // potentially caused by the captive portal. | 756 // potentially caused by the captive portal. |
| 723 captive_portal_detected_ = captive_portal_detected_ || | 757 captive_portal_detected_ = captive_portal_detected_ || |
| 724 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 758 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
| 725 // Also keep track of non-HTTP portals and error cases. | 759 // Also keep track of non-HTTP portals and error cases. |
| 726 captive_portal_no_response_ = captive_portal_no_response_ || | 760 captive_portal_no_response_ = captive_portal_no_response_ || |
| 727 (results->result == captive_portal::RESULT_NO_RESPONSE); | 761 (results->result == captive_portal::RESULT_NO_RESPONSE); |
| 728 } | 762 } |
| 729 #endif | 763 #endif |
| 730 } | 764 } |
| OLD | NEW |