| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 } | 118 } |
| 119 | 119 |
| 120 void CrashesDOMHandler::UpdateUI() { | 120 void CrashesDOMHandler::UpdateUI() { |
| 121 bool crash_reporting_enabled = | 121 bool crash_reporting_enabled = |
| 122 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(); | 122 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(); |
| 123 base::ListValue crash_list; | 123 base::ListValue crash_list; |
| 124 if (crash_reporting_enabled) | 124 if (crash_reporting_enabled) |
| 125 crash::UploadListToValue(upload_list_.get(), &crash_list); | 125 crash::UploadListToValue(upload_list_.get(), &crash_list); |
| 126 base::FundamentalValue enabled(crash_reporting_enabled); | 126 base::FundamentalValue enabled(crash_reporting_enabled); |
| 127 base::FundamentalValue dynamic_backend(false); | 127 base::FundamentalValue dynamic_backend(false); |
| 128 base::FundamentalValue manual_uploads(false); |
| 128 base::StringValue version(version_info::GetVersionNumber()); | 129 base::StringValue version(version_info::GetVersionNumber()); |
| 129 base::StringValue os_string(base::SysInfo::OperatingSystemName() + " " + | 130 base::StringValue os_string(base::SysInfo::OperatingSystemName() + " " + |
| 130 base::SysInfo::OperatingSystemVersion()); | 131 base::SysInfo::OperatingSystemVersion()); |
| 131 | 132 |
| 132 std::vector<const base::Value*> args; | 133 std::vector<const base::Value*> args; |
| 133 args.push_back(&enabled); | 134 args.push_back(&enabled); |
| 134 args.push_back(&dynamic_backend); | 135 args.push_back(&dynamic_backend); |
| 136 args.push_back(&manual_uploads); |
| 135 args.push_back(&crash_list); | 137 args.push_back(&crash_list); |
| 136 args.push_back(&version); | 138 args.push_back(&version); |
| 137 args.push_back(&os_string); | 139 args.push_back(&os_string); |
| 138 web_ui()->CallJavascriptFunction(crash::kCrashesUIUpdateCrashList, args); | 140 web_ui()->CallJavascriptFunction(crash::kCrashesUIUpdateCrashList, args); |
| 139 } | 141 } |
| 140 | 142 |
| 141 } // namespace | 143 } // namespace |
| 142 | 144 |
| 143 /////////////////////////////////////////////////////////////////////////////// | 145 /////////////////////////////////////////////////////////////////////////////// |
| 144 // | 146 // |
| 145 // CrashesUI | 147 // CrashesUI |
| 146 // | 148 // |
| 147 /////////////////////////////////////////////////////////////////////////////// | 149 /////////////////////////////////////////////////////////////////////////////// |
| 148 | 150 |
| 149 CrashesUI::CrashesUI(web::WebUIIOS* web_ui) : web::WebUIIOSController(web_ui) { | 151 CrashesUI::CrashesUI(web::WebUIIOS* web_ui) : web::WebUIIOSController(web_ui) { |
| 150 web_ui->AddMessageHandler(new CrashesDOMHandler()); | 152 web_ui->AddMessageHandler(new CrashesDOMHandler()); |
| 151 | 153 |
| 152 // Set up the chrome://crashes/ source. | 154 // Set up the chrome://crashes/ source. |
| 153 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), | 155 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), |
| 154 CreateCrashesUIHTMLSource()); | 156 CreateCrashesUIHTMLSource()); |
| 155 } | 157 } |
| 156 | 158 |
| 157 // static | 159 // static |
| 158 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( | 160 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( |
| 159 ui::ScaleFactor scale_factor) { | 161 ui::ScaleFactor scale_factor) { |
| 160 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 162 return ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 161 IDR_CRASH_SAD_FAVICON, scale_factor); | 163 IDR_CRASH_SAD_FAVICON, scale_factor); |
| 162 } | 164 } |
| OLD | NEW |