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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 using content::WebContents; | 36 using content::WebContents; |
37 using content::WebUIMessageHandler; | 37 using content::WebUIMessageHandler; |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 content::WebUIDataSource* CreateCrashesUIHTMLSource() { | 41 content::WebUIDataSource* CreateCrashesUIHTMLSource() { |
42 content::WebUIDataSource* source = | 42 content::WebUIDataSource* source = |
43 content::WebUIDataSource::Create(chrome::kChromeUICrashesHost); | 43 content::WebUIDataSource::Create(chrome::kChromeUICrashesHost); |
44 source->SetUseJsonJSFormatV2(); | 44 source->SetUseJsonJSFormatV2(); |
45 | 45 |
| 46 source->AddLocalizedString("shortProductName", IDS_SHORT_PRODUCT_NAME); |
46 source->AddLocalizedString("crashesTitle", IDS_CRASHES_TITLE); | 47 source->AddLocalizedString("crashesTitle", IDS_CRASHES_TITLE); |
47 source->AddLocalizedString("crashCountFormat", | 48 source->AddLocalizedString("crashCountFormat", |
48 IDS_CRASHES_CRASH_COUNT_BANNER_FORMAT); | 49 IDS_CRASHES_CRASH_COUNT_BANNER_FORMAT); |
49 source->AddLocalizedString("crashHeaderFormat", | 50 source->AddLocalizedString("crashHeaderFormat", |
50 IDS_CRASHES_CRASH_HEADER_FORMAT); | 51 IDS_CRASHES_CRASH_HEADER_FORMAT); |
51 source->AddLocalizedString("crashTimeFormat", IDS_CRASHES_CRASH_TIME_FORMAT); | 52 source->AddLocalizedString("crashTimeFormat", IDS_CRASHES_CRASH_TIME_FORMAT); |
52 source->AddLocalizedString("bugLinkText", IDS_CRASHES_BUG_LINK_LABEL); | 53 source->AddLocalizedString("bugLinkText", IDS_CRASHES_BUG_LINK_LABEL); |
53 source->AddLocalizedString("noCrashesMessage", | 54 source->AddLocalizedString("noCrashesMessage", |
54 IDS_CRASHES_NO_CRASHES_MESSAGE); | 55 IDS_CRASHES_NO_CRASHES_MESSAGE); |
55 source->AddLocalizedString("disabledHeader", IDS_CRASHES_DISABLED_HEADER); | 56 source->AddLocalizedString("disabledHeader", IDS_CRASHES_DISABLED_HEADER); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 163 |
163 if (crash_reporting_enabled) { | 164 if (crash_reporting_enabled) { |
164 std::vector<CrashUploadList::UploadInfo> crashes; | 165 std::vector<CrashUploadList::UploadInfo> crashes; |
165 upload_list_->GetUploads(50, &crashes); | 166 upload_list_->GetUploads(50, &crashes); |
166 | 167 |
167 for (std::vector<CrashUploadList::UploadInfo>::iterator i = crashes.begin(); | 168 for (std::vector<CrashUploadList::UploadInfo>::iterator i = crashes.begin(); |
168 i != crashes.end(); ++i) { | 169 i != crashes.end(); ++i) { |
169 base::DictionaryValue* crash = new base::DictionaryValue(); | 170 base::DictionaryValue* crash = new base::DictionaryValue(); |
170 crash->SetString("id", i->id); | 171 crash->SetString("id", i->id); |
171 crash->SetString("time", base::TimeFormatFriendlyDateAndTime(i->time)); | 172 crash->SetString("time", base::TimeFormatFriendlyDateAndTime(i->time)); |
| 173 crash->SetString("local_id", i->local_id); |
172 crash_list.Append(crash); | 174 crash_list.Append(crash); |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 base::FundamentalValue enabled(crash_reporting_enabled); | 178 base::FundamentalValue enabled(crash_reporting_enabled); |
177 base::FundamentalValue dynamic_backend(system_crash_reporter); | 179 base::FundamentalValue dynamic_backend(system_crash_reporter); |
178 | 180 |
179 const chrome::VersionInfo version_info; | 181 const chrome::VersionInfo version_info; |
180 base::StringValue version(version_info.Version()); | 182 base::StringValue version(version_info.Version()); |
181 | 183 |
(...skipping 16 matching lines...) Expand all Loading... |
198 Profile* profile = Profile::FromWebUI(web_ui); | 200 Profile* profile = Profile::FromWebUI(web_ui); |
199 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); | 201 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); |
200 } | 202 } |
201 | 203 |
202 // static | 204 // static |
203 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( | 205 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( |
204 ui::ScaleFactor scale_factor) { | 206 ui::ScaleFactor scale_factor) { |
205 return ResourceBundle::GetSharedInstance(). | 207 return ResourceBundle::GetSharedInstance(). |
206 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); | 208 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); |
207 } | 209 } |
OLD | NEW |