Popular sites on the NTP: re-download popular suggestions once per Chrome run
[chromium-blink-merge.git] / chrome / browser / net / net_error_diagnostics_dialog_mac.cc
blob037e0aa87ac578db306ab236fe8f5eee121de783
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
3 // found in the LICENSE file.
5 #include "chrome/browser/net/net_error_diagnostics_dialog.h"
7 #include <CoreFoundation/CoreFoundation.h>
8 #include <CoreServices/CoreServices.h>
10 #include "base/logging.h"
11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/strings/sys_string_conversions.h"
14 bool CanShowNetworkDiagnosticsDialog() {
15 return false;
18 void ShowNetworkDiagnosticsDialog(content::WebContents* web_contents,
19 const std::string& failed_url) {
20 base::ScopedCFTypeRef<CFStringRef> url_string_ref(
21 base::SysUTF8ToCFStringRef(failed_url));
22 base::ScopedCFTypeRef<CFURLRef> url_ref(
23 CFURLCreateWithString(kCFAllocatorDefault, url_string_ref.get(),
24 nullptr));
25 if (!url_ref.get())
26 return;
28 base::ScopedCFTypeRef<CFNetDiagnosticRef> diagnostic_ref(
29 CFNetDiagnosticCreateWithURL(kCFAllocatorDefault, url_ref.get()));
30 if (!diagnostic_ref.get())
31 return;
33 CFNetDiagnosticDiagnoseProblemInteractively(diagnostic_ref.get());