| 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 "ios/chrome/browser/ui/webui/crashes_ui.h" | 5 #include "ios/chrome/browser/ui/webui/crashes_ui.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (!first_load_) | 114 if (!first_load_) |
| 115 UpdateUI(); | 115 UpdateUI(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void CrashesDOMHandler::UpdateUI() { | 118 void CrashesDOMHandler::UpdateUI() { |
| 119 bool crash_reporting_enabled = | 119 bool crash_reporting_enabled = |
| 120 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(); | 120 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(); |
| 121 base::ListValue crash_list; | 121 base::ListValue crash_list; |
| 122 if (crash_reporting_enabled) | 122 if (crash_reporting_enabled) |
| 123 crash::UploadListToValue(upload_list_.get(), &crash_list); | 123 crash::UploadListToValue(upload_list_.get(), &crash_list); |
| 124 base::FundamentalValue enabled(crash_reporting_enabled); | 124 base::Value enabled(crash_reporting_enabled); |
| 125 base::FundamentalValue dynamic_backend(false); | 125 base::Value dynamic_backend(false); |
| 126 base::FundamentalValue manual_uploads(false); | 126 base::Value manual_uploads(false); |
| 127 base::StringValue version(version_info::GetVersionNumber()); | 127 base::StringValue version(version_info::GetVersionNumber()); |
| 128 base::StringValue os_string(base::SysInfo::OperatingSystemName() + " " + | 128 base::StringValue os_string(base::SysInfo::OperatingSystemName() + " " + |
| 129 base::SysInfo::OperatingSystemVersion()); | 129 base::SysInfo::OperatingSystemVersion()); |
| 130 | 130 |
| 131 std::vector<const base::Value*> args; | 131 std::vector<const base::Value*> args; |
| 132 args.push_back(&enabled); | 132 args.push_back(&enabled); |
| 133 args.push_back(&dynamic_backend); | 133 args.push_back(&dynamic_backend); |
| 134 args.push_back(&manual_uploads); | 134 args.push_back(&manual_uploads); |
| 135 args.push_back(&crash_list); | 135 args.push_back(&crash_list); |
| 136 args.push_back(&version); | 136 args.push_back(&version); |
| 137 args.push_back(&os_string); | 137 args.push_back(&os_string); |
| 138 web_ui()->CallJavascriptFunction(crash::kCrashesUIUpdateCrashList, args); | 138 web_ui()->CallJavascriptFunction(crash::kCrashesUIUpdateCrashList, args); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace | 141 } // namespace |
| 142 | 142 |
| 143 /////////////////////////////////////////////////////////////////////////////// | 143 /////////////////////////////////////////////////////////////////////////////// |
| 144 // | 144 // |
| 145 // CrashesUI | 145 // CrashesUI |
| 146 // | 146 // |
| 147 /////////////////////////////////////////////////////////////////////////////// | 147 /////////////////////////////////////////////////////////////////////////////// |
| 148 | 148 |
| 149 CrashesUI::CrashesUI(web::WebUIIOS* web_ui) : web::WebUIIOSController(web_ui) { | 149 CrashesUI::CrashesUI(web::WebUIIOS* web_ui) : web::WebUIIOSController(web_ui) { |
| 150 web_ui->AddMessageHandler(base::MakeUnique<CrashesDOMHandler>()); | 150 web_ui->AddMessageHandler(base::MakeUnique<CrashesDOMHandler>()); |
| 151 | 151 |
| 152 // Set up the chrome://crashes/ source. | 152 // Set up the chrome://crashes/ source. |
| 153 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 153 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), |
| 154 CreateCrashesUIHTMLSource()); | 154 CreateCrashesUIHTMLSource()); |
| 155 } | 155 } |
| OLD | NEW |