Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.cc

Issue 397713007: Provide an option to launch the date and time preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows compile, hopefully. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
44 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
45 #include "ui/base/webui/jstemplate_builder.h" 46 #include "ui/base/webui/jstemplate_builder.h"
46 #include "ui/base/webui/web_ui_util.h" 47 #include "ui/base/webui/web_ui_util.h"
47 48
48 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 49 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
49 #include "chrome/browser/captive_portal/captive_portal_service.h" 50 #include "chrome/browser/captive_portal/captive_portal_service.h"
50 #include "chrome/browser/captive_portal/captive_portal_service_factory.h" 51 #include "chrome/browser/captive_portal/captive_portal_service_factory.h"
51 #endif 52 #endif
52 53
53 #if defined(OS_WIN) 54 #if defined(OS_WIN)
55 #include "base/base_paths_win.h"
56 #include "base/path_service.h"
54 #include "base/win/windows_version.h" 57 #include "base/win/windows_version.h"
55 #endif 58 #endif
56 59
60 #if defined(OS_CHROMEOS)
61 #include "chrome/browser/profiles/profile_manager.h"
62 #include "chrome/common/url_constants.h"
63 #endif
64
57 using base::ASCIIToUTF16; 65 using base::ASCIIToUTF16;
58 using base::TimeTicks; 66 using base::TimeTicks;
59 using content::InterstitialPage; 67 using content::InterstitialPage;
60 using content::NavigationController; 68 using content::NavigationController;
61 using content::NavigationEntry; 69 using content::NavigationEntry;
62 70
63 namespace { 71 namespace {
64 72
65 // Constants for the M37 Finch trial. 73 // Constants for the M37 Finch trial.
66 const char kInterstitialTrialName[] = "SSLInterstitialVersion"; 74 const char kInterstitialTrialName[] = "SSLInterstitialVersion";
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 else 217 else
210 RecordSSLBlockingPageEventStats(DONT_PROCEED_AUTHORITY); 218 RecordSSLBlockingPageEventStats(DONT_PROCEED_AUTHORITY);
211 break; 219 break;
212 } 220 }
213 default: { 221 default: {
214 break; 222 break;
215 } 223 }
216 } 224 }
217 } 225 }
218 226
227 void LaunchDateAndTimeSettings() {
228 #if defined(OS_CHROMEOS)
229 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" +
230 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME);
231 chrome::ShowSettingsSubPageForProfile(
232 ProfileManager::GetActiveUserProfile(), sub_page);
233 return;
234 #elif defined(OS_ANDROID)
235 CommandLine command(base::FilePath("/system/bin/am"));
236 command.AppendArg("start");
237 command.AppendArg(
238 "'com.android.settings/.Settings$DateTimeSettingsActivity'");
239 #elif defined(OS_IOS)
240 // TODO(palmer)
241 return;
242 #elif defined(OS_LINUX)
243 CommandLine command(base::FilePath("/usr/bin/gnome-control-center"));
244 // NOTE: On old Ubuntu, naming control panels doesn't work, so it
245 // opens the overview. This will have to be good enough.
246 command.AppendArg("datetime");
247 //
248 // TODO(palmer): Provide an option for KDE, et c.
249 #elif defined(OS_MACOSX)
250 CommandLine command(base::FilePath("/usr/bin/open"));
251 command.AppendArg("/System/Library/PreferencePanes/DateAndTime.prefPane");
252 #elif defined(OS_WIN)
253 base::FilePath path;
254 PathService::Get(base::DIR_SYSTEM, &path);
255 path = path.Append(std::wstring(L"control.exe"));
256 CommandLine command(path);
257 command.AppendArg(std::string("/name"));
258 command.AppendArg(std::string("Microsoft.DateAndTime"));
259 #else
260 return;
261 #endif
262
263 VLOG(1) << "Running " << command.GetCommandLineString();
264 base::LaunchOptions options;
Robert Sesek 2014/07/16 13:52:52 You may need to set allow_new_privs = true on Linu
265 options.wait = false;
266 base::LaunchProcess(command, options, NULL);
267 }
268
219 } // namespace 269 } // namespace
220 270
221 // Note that we always create a navigation entry with SSL errors. 271 // Note that we always create a navigation entry with SSL errors.
222 // No error happening loading a sub-resource triggers an interstitial so far. 272 // No error happening loading a sub-resource triggers an interstitial so far.
223 SSLBlockingPage::SSLBlockingPage( 273 SSLBlockingPage::SSLBlockingPage(
224 content::WebContents* web_contents, 274 content::WebContents* web_contents,
225 int cert_error, 275 int cert_error,
226 const net::SSLInfo& ssl_info, 276 const net::SSLInfo& ssl_info,
227 const GURL& request_url, 277 const GURL& request_url,
228 bool overridable, 278 bool overridable,
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 web_contents_->GetController().Reload(true); 654 web_contents_->GetController().Reload(true);
605 break; 655 break;
606 } 656 }
607 case CMD_HELP: { 657 case CMD_HELP: {
608 content::NavigationController::LoadURLParams help_page_params(GURL( 658 content::NavigationController::LoadURLParams help_page_params(GURL(
609 "https://support.google.com/chrome/answer/4454607")); 659 "https://support.google.com/chrome/answer/4454607"));
610 web_contents_->GetController().LoadURLWithParams(help_page_params); 660 web_contents_->GetController().LoadURLWithParams(help_page_params);
611 break; 661 break;
612 } 662 }
613 case CMD_CLOCK: { 663 case CMD_CLOCK: {
614 content::NavigationController::LoadURLParams help_page_params(GURL( 664 LaunchDateAndTimeSettings();
615 "https://support.google.com/chrome/?p=ui_system_clock"));
616 web_contents_->GetController().LoadURLWithParams(help_page_params);
617 break; 665 break;
618 } 666 }
619 default: { 667 default: {
620 NOTREACHED(); 668 NOTREACHED();
621 } 669 }
622 } 670 }
623 } 671 }
624 672
625 void SSLBlockingPage::OverrideRendererPrefs( 673 void SSLBlockingPage::OverrideRendererPrefs(
626 content::RendererPreferences* prefs) { 674 content::RendererPreferences* prefs) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // sure we don't clear the captive portal flag, since the interstitial was 769 // sure we don't clear the captive portal flag, since the interstitial was
722 // potentially caused by the captive portal. 770 // potentially caused by the captive portal.
723 captive_portal_detected_ = captive_portal_detected_ || 771 captive_portal_detected_ = captive_portal_detected_ ||
724 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); 772 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL);
725 // Also keep track of non-HTTP portals and error cases. 773 // Also keep track of non-HTTP portals and error cases.
726 captive_portal_no_response_ = captive_portal_no_response_ || 774 captive_portal_no_response_ = captive_portal_no_response_ ||
727 (results->result == captive_portal::RESULT_NO_RESPONSE); 775 (results->result == captive_portal::RESULT_NO_RESPONSE);
728 } 776 }
729 #endif 777 #endif
730 } 778 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698