forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move crashes_ui resources and utils to //components/crash
TBR=jochen Review URL: https://codereview.chromium.org/1389913002 Cr-Commit-Position: refs/heads/master@{#353044}
- Loading branch information
droger
authored and
Commit bot
committed
Oct 8, 2015
1 parent
2cbf915
commit b7e240e
Showing
18 changed files
with
176 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2015 The Chromium Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
|
||
source_set("browser") { | ||
sources = [ | ||
"crashes_ui_util.cc", | ||
"crashes_ui_util.h", | ||
] | ||
deps = [ | ||
"//base", | ||
"//components/strings", | ||
"//components/upload_list", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include_rules = [ | ||
"+components/upload_list", | ||
"+grit/components_chromium_strings.h", | ||
"+grit/components_google_chrome_strings.h", | ||
"+grit/components_strings.h", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/crash/core/browser/crashes_ui_util.h" | ||
|
||
#include <vector> | ||
|
||
#include "base/i18n/time_formatting.h" | ||
#include "base/macros.h" | ||
#include "base/values.h" | ||
#include "components/upload_list/upload_list.h" | ||
#include "grit/components_chromium_strings.h" | ||
#include "grit/components_google_chrome_strings.h" | ||
#include "grit/components_strings.h" | ||
|
||
namespace crash { | ||
|
||
const CrashesUILocalizedString kCrashesUILocalizedStrings[] = { | ||
{"bugLinkText", IDS_CRASH_BUG_LINK_LABEL}, | ||
{"crashCountFormat", IDS_CRASH_CRASH_COUNT_BANNER_FORMAT}, | ||
{"crashHeaderFormat", IDS_CRASH_CRASH_HEADER_FORMAT}, | ||
{"crashTimeFormat", IDS_CRASH_CRASH_TIME_FORMAT}, | ||
{"crashesTitle", IDS_CRASH_TITLE}, | ||
{"disabledHeader", IDS_CRASH_DISABLED_HEADER}, | ||
{"disabledMessage", IDS_CRASH_DISABLED_MESSAGE}, | ||
{"noCrashesMessage", IDS_CRASH_NO_CRASHES_MESSAGE}, | ||
{"uploadCrashesLinkText", IDS_CRASH_UPLOAD_MESSAGE}, | ||
}; | ||
|
||
const size_t kCrashesUILocalizedStringsCount = | ||
arraysize(kCrashesUILocalizedStrings); | ||
|
||
const char kCrashesUICrashesJS[] = "crashes.js"; | ||
const char kCrashesUIRequestCrashList[] = "requestCrashList"; | ||
const char kCrashesUIRequestCrashUpload[] = "requestCrashUpload"; | ||
const char kCrashesUIShortProductName[] = "shortProductName"; | ||
const char kCrashesUIUpdateCrashList[] = "updateCrashList"; | ||
|
||
void UploadListToValue(UploadList* upload_list, base::ListValue* out_value) { | ||
std::vector<UploadList::UploadInfo> crashes; | ||
upload_list->GetUploads(50, &crashes); | ||
|
||
for (const auto& info : crashes) { | ||
base::DictionaryValue* crash = new base::DictionaryValue(); | ||
crash->SetString("id", info.id); | ||
crash->SetString("time", base::TimeFormatFriendlyDateAndTime(info.time)); | ||
crash->SetString("local_id", info.local_id); | ||
out_value->Append(crash); | ||
} | ||
} | ||
|
||
} // namespace crash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef COMPONENTS_CRASH_CORE_BROWSER_CRASHES_UI_UTIL_H_ | ||
#define COMPONENTS_CRASH_CORE_BROWSER_CRASHES_UI_UTIL_H_ | ||
|
||
#include <stddef.h> | ||
|
||
namespace base { | ||
class ListValue; | ||
} | ||
|
||
class UploadList; | ||
|
||
namespace crash { | ||
|
||
// Mapping between a WebUI resource (identified by |name|) and a GRIT resource | ||
// (identified by |resource_id|). | ||
struct CrashesUILocalizedString { | ||
const char* name; | ||
int resource_id; | ||
}; | ||
|
||
// List of localized strings that must be added to the WebUI. | ||
extern const CrashesUILocalizedString kCrashesUILocalizedStrings[]; | ||
extern const size_t kCrashesUILocalizedStringsCount; | ||
|
||
// Strings used by the WebUI resources. | ||
// Must match the constants used in the resource files. | ||
extern const char kCrashesUICrashesJS[]; | ||
extern const char kCrashesUIRequestCrashList[]; | ||
extern const char kCrashesUIRequestCrashUpload[]; | ||
extern const char kCrashesUIShortProductName[]; | ||
extern const char kCrashesUIUpdateCrashList[]; | ||
|
||
// Converts and appends the most recent uploads to |out_value|. | ||
void UploadListToValue(UploadList* upload_list, base::ListValue* out_value); | ||
|
||
} // namespace crash | ||
|
||
#endif // COMPONENTS_CRASH_CORE_BROWSER_CRASHES_UI_UTIL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<grit-part> | ||
<structure type="chrome_scaled_image" name="IDR_CRASH_SAD_FAVICON" file="crash/favicon_sad_tab.png" /> | ||
</grit-part> |
File renamed without changes
File renamed without changes
File renamed without changes