| 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 "content/browser/net/network_errors_listing_ui.h" | 5 #include "content/browser/net/network_errors_listing_ui.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return error_list; | 57 return error_list; |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool HandleRequestCallback(BrowserContext* current_context, | 60 bool HandleRequestCallback(BrowserContext* current_context, |
| 61 const std::string& path, | 61 const std::string& path, |
| 62 const WebUIDataSource::GotDataCallback& callback) { | 62 const WebUIDataSource::GotDataCallback& callback) { |
| 63 if (path != kDataFile) | 63 if (path != kDataFile) |
| 64 return false; | 64 return false; |
| 65 | 65 |
| 66 base::DictionaryValue data; | 66 base::DictionaryValue data; |
| 67 data.Set(kErrorCodesDataName, GetNetworkErrorData().release()); | 67 data.Set(kErrorCodesDataName, GetNetworkErrorData()); |
| 68 std::string json_string; | 68 std::string json_string; |
| 69 base::JSONWriter::Write(data, &json_string); | 69 base::JSONWriter::Write(data, &json_string); |
| 70 callback.Run(base::RefCountedString::TakeString(&json_string)); | 70 callback.Run(base::RefCountedString::TakeString(&json_string)); |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 NetworkErrorsListingUI::NetworkErrorsListingUI(WebUI* web_ui) | 76 NetworkErrorsListingUI::NetworkErrorsListingUI(WebUI* web_ui) |
| 77 : WebUIController(web_ui) { | 77 : WebUIController(web_ui) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 html_source->SetRequestFilter( | 89 html_source->SetRequestFilter( |
| 90 base::Bind(&HandleRequestCallback, | 90 base::Bind(&HandleRequestCallback, |
| 91 web_ui->GetWebContents()->GetBrowserContext())); | 91 web_ui->GetWebContents()->GetBrowserContext())); |
| 92 | 92 |
| 93 BrowserContext* browser_context = | 93 BrowserContext* browser_context = |
| 94 web_ui->GetWebContents()->GetBrowserContext(); | 94 web_ui->GetWebContents()->GetBrowserContext(); |
| 95 WebUIDataSource::Add(browser_context, html_source); | 95 WebUIDataSource::Add(browser_context, html_source); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace content | 98 } // namespace content |
| OLD | NEW |