Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Unified Diff: chrome/browser/ui/webui/feedback_ui.cc

Issue 10908081: Refactor screenshot directory source (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/screenshot_taker.cc ('k') | chrome/browser/ui/webui/screenshot_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/feedback_ui.cc
diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc
index ec0846b13454b2b2a471c109b6b2d0153fbf2b4b..6636b4de31bb4f7841d6d314b44f08563457c493 100644
--- a/chrome/browser/ui/webui/feedback_ui.cc
+++ b/chrome/browser/ui/webui/feedback_ui.cc
@@ -76,9 +76,6 @@ using ui::WebDialogUI;
namespace {
-const char kScreenshotBaseUrl[] = "chrome://screenshots/";
-const char kCurrentScreenshotUrl[] = "chrome://screenshots/current";
-
const char kCategoryTagParameter[] = "categoryTag=";
const char kDescriptionParameter[] = "description=";
const char kSessionIDParameter[] = "session_id=";
@@ -86,16 +83,10 @@ const char kTabIndexParameter[] = "tab_index=";
const char kCustomPageUrlParameter[] = "customPageUrl=";
#if defined(OS_CHROMEOS)
-const char kSavedScreenshotsUrl[] = "chrome://screenshots/saved/";
-const char kScreenshotPrefix[] = "Screenshot ";
-const char kScreenshotSuffix[] = ".png";
const char kTimestampParameter[] = "timestamp=";
const size_t kMaxSavedScreenshots = 2;
-#endif
-
-#if defined(OS_CHROMEOS)
size_t kMaxNumScanFiles = 1000;
// Compare two screenshot filepaths, which include the screenshot timestamp
@@ -135,8 +126,10 @@ void ReadDirectoryCallback(size_t max_saved,
std::vector<gdata::DriveEntryProto> screenshot_entries;
for (size_t i = 0; i < max_scan; ++i) {
const gdata::DriveEntryProto& entry = (*entries)[i];
- if (StartsWithASCII(entry.base_name(), kScreenshotPrefix, true) &&
- EndsWith(entry.base_name(), kScreenshotSuffix, true)) {
+ if (StartsWithASCII(entry.base_name(),
+ ScreenshotSource::kScreenshotPrefix, true) &&
+ EndsWith(entry.base_name(),
+ ScreenshotSource::kScreenshotSuffix, true)) {
screenshot_entries.push_back(entry);
}
}
@@ -149,7 +142,9 @@ void ReadDirectoryCallback(size_t max_saved,
for (size_t i = 0; i < sort_size; ++i) {
const gdata::DriveEntryProto& entry = screenshot_entries[i];
saved_screenshots->push_back(
- std::string(kSavedScreenshotsUrl) + entry.resource_id());
+ std::string(ScreenshotSource::kScreenshotUrlRoot) +
+ std::string(ScreenshotSource::kScreenshotSaved) +
+ entry.resource_id());
}
callback.Run();
}
@@ -548,7 +543,9 @@ void FeedbackHandler::HandleGetDialogDefaults(const ListValue*) {
}
void FeedbackHandler::HandleRefreshCurrentScreenshot(const ListValue*) {
- std::string current_screenshot(kCurrentScreenshotUrl);
+ std::string current_screenshot(
+ std::string(ScreenshotSource::kScreenshotUrlRoot) +
+ std::string(ScreenshotSource::kScreenshotCurrent));
StringValue screenshot(current_screenshot);
web_ui()->CallJavascriptFunction("setupCurrentScreenshot", screenshot);
}
@@ -621,7 +618,7 @@ void FeedbackHandler::HandleSendReport(const ListValue* list_value) {
(*i++)->GetAsString(&user_email);
std::string screenshot_path;
(*i++)->GetAsString(&screenshot_path);
- screenshot_path.erase(0, strlen(kScreenshotBaseUrl));
+ screenshot_path.erase(0, strlen(ScreenshotSource::kScreenshotUrlRoot));
// Get the image to send in the report.
ScreenshotDataPtr image_ptr;
@@ -732,7 +729,8 @@ void FeedbackUI::GetMostRecentScreenshots(
std::vector<std::string>* saved_screenshots,
size_t max_saved) {
std::string pattern =
- std::string(kScreenshotPrefix) + "*" + kScreenshotSuffix;
+ std::string(ScreenshotSource::kScreenshotPrefix) + "*" +
+ ScreenshotSource::kScreenshotSuffix;
file_util::FileEnumerator screenshots(filepath, false,
file_util::FileEnumerator::FILES,
pattern);
@@ -750,7 +748,9 @@ void FeedbackUI::GetMostRecentScreenshots(
screenshot_filepaths.end(),
ScreenshotTimestampComp);
for (size_t i = 0; i < sort_size; ++i)
- saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) +
- screenshot_filepaths[i]);
+ saved_screenshots->push_back(
+ std::string(ScreenshotSource::kScreenshotUrlRoot) +
+ std::string(ScreenshotSource::kScreenshotSaved) +
+ screenshot_filepaths[i]);
}
#endif
« no previous file with comments | « chrome/browser/ui/ash/screenshot_taker.cc ('k') | chrome/browser/ui/webui/screenshot_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698