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

Side by Side Diff: chrome/browser/ui/webui/feedback_ui.cc

Issue 10382142: whip the feedback page into shape (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/shared/css/widgets.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/feedback_ui.h" 5 #include "chrome/browser/ui/webui/feedback_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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // Timestamp of when the feedback request was initiated. 223 // Timestamp of when the feedback request was initiated.
224 std::string timestamp_; 224 std::string timestamp_;
225 #endif 225 #endif
226 226
227 DISALLOW_COPY_AND_ASSIGN(FeedbackHandler); 227 DISALLOW_COPY_AND_ASSIGN(FeedbackHandler);
228 }; 228 };
229 229
230 ChromeWebUIDataSource* CreateFeedbackUIHTMLSource(bool successful_init) { 230 ChromeWebUIDataSource* CreateFeedbackUIHTMLSource(bool successful_init) {
231 ChromeWebUIDataSource* source = 231 ChromeWebUIDataSource* source =
232 new ChromeWebUIDataSource(chrome::kChromeUIFeedbackHost); 232 new ChromeWebUIDataSource(chrome::kChromeUIFeedbackHost);
233 source->set_use_json_js_format_v2();
233 234
234 source->AddLocalizedString("title", IDS_FEEDBACK_TITLE); 235 source->AddLocalizedString("title", IDS_FEEDBACK_TITLE);
235 source->AddLocalizedString("page-title", IDS_FEEDBACK_REPORT_PAGE_TITLE); 236 source->AddLocalizedString("page-title", IDS_FEEDBACK_REPORT_PAGE_TITLE);
236 source->AddLocalizedString("page-url", IDS_FEEDBACK_REPORT_URL_LABEL); 237 source->AddLocalizedString("page-url", IDS_FEEDBACK_REPORT_URL_LABEL);
237 source->AddLocalizedString("description", IDS_FEEDBACK_DESCRIPTION_LABEL); 238 source->AddLocalizedString("description", IDS_FEEDBACK_DESCRIPTION_LABEL);
238 source->AddLocalizedString("current-screenshot", 239 source->AddLocalizedString("current-screenshot",
239 IDS_FEEDBACK_SCREENSHOT_LABEL); 240 IDS_FEEDBACK_SCREENSHOT_LABEL);
240 source->AddLocalizedString("saved-screenshot", 241 source->AddLocalizedString("saved-screenshot",
241 IDS_FEEDBACK_SAVED_SCREENSHOT_LABEL); 242 IDS_FEEDBACK_SAVED_SCREENSHOT_LABEL);
242 #if defined(OS_CHROMEOS) 243 #if defined(OS_CHROMEOS)
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 434
434 web_ui()->CallJavascriptFunction("setupDialogDefaults", dialog_defaults); 435 web_ui()->CallJavascriptFunction("setupDialogDefaults", dialog_defaults);
435 } 436 }
436 437
437 void FeedbackHandler::HandleRefreshCurrentScreenshot(const ListValue*) { 438 void FeedbackHandler::HandleRefreshCurrentScreenshot(const ListValue*) {
438 std::string current_screenshot(kCurrentScreenshotUrl); 439 std::string current_screenshot(kCurrentScreenshotUrl);
439 StringValue screenshot(current_screenshot); 440 StringValue screenshot(current_screenshot);
440 web_ui()->CallJavascriptFunction("setupCurrentScreenshot", screenshot); 441 web_ui()->CallJavascriptFunction("setupCurrentScreenshot", screenshot);
441 } 442 }
442 443
443
444 #if defined(OS_CHROMEOS) 444 #if defined(OS_CHROMEOS)
445 void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) { 445 void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) {
446 std::vector<std::string>* saved_screenshots = new std::vector<std::string>; 446 std::vector<std::string>* saved_screenshots = new std::vector<std::string>;
447 BrowserThread::PostTaskAndReply( 447 BrowserThread::PostTaskAndReply(
448 BrowserThread::FILE, FROM_HERE, 448 BrowserThread::FILE, FROM_HERE,
449 base::Bind(&GetSavedScreenshots, base::Unretained(saved_screenshots)), 449 base::Bind(&GetSavedScreenshots, base::Unretained(saved_screenshots)),
450 base::Bind(&FeedbackHandler::RefreshSavedScreenshotsCallback, 450 base::Bind(&FeedbackHandler::RefreshSavedScreenshotsCallback,
451 base::Unretained(this), base::Owned(saved_screenshots))); 451 base::Unretained(this), base::Owned(saved_screenshots)));
452 } 452 }
453 453
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); 619 size_t sort_size = std::min(max_saved, screenshot_filepaths.size());
620 std::partial_sort(screenshot_filepaths.begin(), 620 std::partial_sort(screenshot_filepaths.begin(),
621 screenshot_filepaths.begin() + sort_size, 621 screenshot_filepaths.begin() + sort_size,
622 screenshot_filepaths.end(), 622 screenshot_filepaths.end(),
623 ScreenshotTimestampComp); 623 ScreenshotTimestampComp);
624 for (size_t i = 0; i < sort_size; ++i) 624 for (size_t i = 0; i < sort_size; ++i)
625 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + 625 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) +
626 screenshot_filepaths[i]); 626 screenshot_filepaths[i]);
627 } 627 }
628 #endif 628 #endif
OLDNEW
« no previous file with comments | « chrome/browser/resources/shared/css/widgets.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698