| OLD | NEW |
| 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/ui/webui/crashes_ui.h" | 5 #include "chrome/browser/ui/webui/crashes_ui.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/crash_upload_list.h" | 15 #include "chrome/browser/crash_upload_list.h" |
| 16 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 16 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_version_info.h" | |
| 19 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 19 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 21 #include "components/version_info/version_info.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/browser/web_ui.h" | 23 #include "content/public/browser/web_ui.h" |
| 24 #include "content/public/browser/web_ui_data_source.h" | 24 #include "content/public/browser/web_ui_data_source.h" |
| 25 #include "content/public/browser/web_ui_message_handler.h" | 25 #include "content/public/browser/web_ui_message_handler.h" |
| 26 #include "grit/browser_resources.h" | 26 #include "grit/browser_resources.h" |
| 27 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 28 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 29 | 29 |
| 30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 crash->SetString("id", i->id); | 169 crash->SetString("id", i->id); |
| 170 crash->SetString("time", base::TimeFormatFriendlyDateAndTime(i->time)); | 170 crash->SetString("time", base::TimeFormatFriendlyDateAndTime(i->time)); |
| 171 crash->SetString("local_id", i->local_id); | 171 crash->SetString("local_id", i->local_id); |
| 172 crash_list.Append(crash); | 172 crash_list.Append(crash); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 base::FundamentalValue enabled(crash_reporting_enabled); | 176 base::FundamentalValue enabled(crash_reporting_enabled); |
| 177 base::FundamentalValue dynamic_backend(system_crash_reporter); | 177 base::FundamentalValue dynamic_backend(system_crash_reporter); |
| 178 | 178 |
| 179 const chrome::VersionInfo version_info; | 179 base::StringValue version(version_info::GetVersionNumber()); |
| 180 base::StringValue version(version_info.Version()); | |
| 181 | 180 |
| 182 web_ui()->CallJavascriptFunction("updateCrashList", enabled, dynamic_backend, | 181 web_ui()->CallJavascriptFunction("updateCrashList", enabled, dynamic_backend, |
| 183 crash_list, version); | 182 crash_list, version); |
| 184 } | 183 } |
| 185 | 184 |
| 186 } // namespace | 185 } // namespace |
| 187 | 186 |
| 188 /////////////////////////////////////////////////////////////////////////////// | 187 /////////////////////////////////////////////////////////////////////////////// |
| 189 // | 188 // |
| 190 // CrashesUI | 189 // CrashesUI |
| 191 // | 190 // |
| 192 /////////////////////////////////////////////////////////////////////////////// | 191 /////////////////////////////////////////////////////////////////////////////// |
| 193 | 192 |
| 194 CrashesUI::CrashesUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 193 CrashesUI::CrashesUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 195 web_ui->AddMessageHandler(new CrashesDOMHandler()); | 194 web_ui->AddMessageHandler(new CrashesDOMHandler()); |
| 196 | 195 |
| 197 // Set up the chrome://crashes/ source. | 196 // Set up the chrome://crashes/ source. |
| 198 Profile* profile = Profile::FromWebUI(web_ui); | 197 Profile* profile = Profile::FromWebUI(web_ui); |
| 199 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); | 198 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); |
| 200 } | 199 } |
| 201 | 200 |
| 202 // static | 201 // static |
| 203 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( | 202 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( |
| 204 ui::ScaleFactor scale_factor) { | 203 ui::ScaleFactor scale_factor) { |
| 205 return ResourceBundle::GetSharedInstance(). | 204 return ResourceBundle::GetSharedInstance(). |
| 206 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); | 205 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); |
| 207 } | 206 } |
| OLD | NEW |