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/metrics_service.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" | 18 #include "chrome/common/chrome_version_info.h" |
19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
22 #include "content/public/browser/web_ui_data_source.h" | 22 #include "content/public/browser/web_ui_data_source.h" |
23 #include "content/public/browser/web_ui_message_handler.h" | 23 #include "content/public/browser/web_ui_message_handler.h" |
24 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
25 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
26 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #endif | 145 #endif |
146 | 146 |
147 void CrashesDOMHandler::OnUploadListAvailable() { | 147 void CrashesDOMHandler::OnUploadListAvailable() { |
148 list_available_ = true; | 148 list_available_ = true; |
149 if (!first_load_) | 149 if (!first_load_) |
150 UpdateUI(); | 150 UpdateUI(); |
151 } | 151 } |
152 | 152 |
153 void CrashesDOMHandler::UpdateUI() { | 153 void CrashesDOMHandler::UpdateUI() { |
154 bool crash_reporting_enabled = | 154 bool crash_reporting_enabled = |
155 MetricsServiceHelper::IsCrashReportingEnabled(); | 155 ChromeMetricsServiceAccessor::IsCrashReportingEnabled(); |
156 base::ListValue crash_list; | 156 base::ListValue crash_list; |
157 bool system_crash_reporter = false; | 157 bool system_crash_reporter = false; |
158 | 158 |
159 #if defined(OS_CHROMEOS) | 159 #if defined(OS_CHROMEOS) |
160 // Chrome OS has a system crash reporter. | 160 // Chrome OS has a system crash reporter. |
161 system_crash_reporter = true; | 161 system_crash_reporter = true; |
162 #endif | 162 #endif |
163 | 163 |
164 if (crash_reporting_enabled) { | 164 if (crash_reporting_enabled) { |
165 std::vector<CrashUploadList::UploadInfo> crashes; | 165 std::vector<CrashUploadList::UploadInfo> crashes; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 Profile* profile = Profile::FromWebUI(web_ui); | 200 Profile* profile = Profile::FromWebUI(web_ui); |
201 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); | 201 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); |
202 } | 202 } |
203 | 203 |
204 // static | 204 // static |
205 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( | 205 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( |
206 ui::ScaleFactor scale_factor) { | 206 ui::ScaleFactor scale_factor) { |
207 return ResourceBundle::GetSharedInstance(). | 207 return ResourceBundle::GetSharedInstance(). |
208 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); | 208 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); |
209 } | 209 } |
OLD | NEW |