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

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: upload 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
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Timestamp of when the feedback request was initiated. 211 // Timestamp of when the feedback request was initiated.
212 std::string timestamp_; 212 std::string timestamp_;
213 #endif 213 #endif
214 214
215 DISALLOW_COPY_AND_ASSIGN(FeedbackHandler); 215 DISALLOW_COPY_AND_ASSIGN(FeedbackHandler);
216 }; 216 };
217 217
218 ChromeWebUIDataSource* CreateFeedbackUIHTMLSource(bool successful_init) { 218 ChromeWebUIDataSource* CreateFeedbackUIHTMLSource(bool successful_init) {
219 ChromeWebUIDataSource* source = 219 ChromeWebUIDataSource* source =
220 new ChromeWebUIDataSource(chrome::kChromeUIFeedbackHost); 220 new ChromeWebUIDataSource(chrome::kChromeUIFeedbackHost);
221 source->set_use_json_js_format_v2();
221 222
222 source->AddLocalizedString("title", IDS_FEEDBACK_TITLE); 223 source->AddLocalizedString("title", IDS_FEEDBACK_TITLE);
223 source->AddLocalizedString("page-title", IDS_FEEDBACK_REPORT_PAGE_TITLE); 224 source->AddLocalizedString("page-title", IDS_FEEDBACK_REPORT_PAGE_TITLE);
224 source->AddLocalizedString("page-url", IDS_FEEDBACK_REPORT_URL_LABEL); 225 source->AddLocalizedString("page-url", IDS_FEEDBACK_REPORT_URL_LABEL);
225 source->AddLocalizedString("description", IDS_FEEDBACK_DESCRIPTION_LABEL); 226 source->AddLocalizedString("description", IDS_FEEDBACK_DESCRIPTION_LABEL);
226 source->AddLocalizedString("current-screenshot", 227 source->AddLocalizedString("current-screenshot",
227 IDS_FEEDBACK_SCREENSHOT_LABEL); 228 IDS_FEEDBACK_SCREENSHOT_LABEL);
228 source->AddLocalizedString("saved-screenshot", 229 source->AddLocalizedString("saved-screenshot",
229 IDS_FEEDBACK_SAVED_SCREENSHOT_LABEL); 230 IDS_FEEDBACK_SAVED_SCREENSHOT_LABEL);
230 #if defined(OS_CHROMEOS) 231 #if defined(OS_CHROMEOS)
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 422
422 web_ui()->CallJavascriptFunction("setupDialogDefaults", dialog_defaults); 423 web_ui()->CallJavascriptFunction("setupDialogDefaults", dialog_defaults);
423 } 424 }
424 425
425 void FeedbackHandler::HandleRefreshCurrentScreenshot(const ListValue*) { 426 void FeedbackHandler::HandleRefreshCurrentScreenshot(const ListValue*) {
426 std::string current_screenshot(kCurrentScreenshotUrl); 427 std::string current_screenshot(kCurrentScreenshotUrl);
427 StringValue screenshot(current_screenshot); 428 StringValue screenshot(current_screenshot);
428 web_ui()->CallJavascriptFunction("setupCurrentScreenshot", screenshot); 429 web_ui()->CallJavascriptFunction("setupCurrentScreenshot", screenshot);
429 } 430 }
430 431
431
432 #if defined(OS_CHROMEOS) 432 #if defined(OS_CHROMEOS)
433 void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) { 433 void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) {
434 std::vector<std::string>* saved_screenshots = new std::vector<std::string>; 434 std::vector<std::string>* saved_screenshots = new std::vector<std::string>;
435 BrowserThread::PostTaskAndReply( 435 BrowserThread::PostTaskAndReply(
436 BrowserThread::FILE, FROM_HERE, 436 BrowserThread::FILE, FROM_HERE,
437 base::Bind(&GetSavedScreenshots, base::Unretained(saved_screenshots)), 437 base::Bind(&GetSavedScreenshots, base::Unretained(saved_screenshots)),
438 base::Bind(&FeedbackHandler::RefreshSavedScreenshotsCallback, 438 base::Bind(&FeedbackHandler::RefreshSavedScreenshotsCallback,
439 base::Unretained(this), base::Owned(saved_screenshots))); 439 base::Unretained(this), base::Owned(saved_screenshots)));
440 } 440 }
441 441
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); 607 size_t sort_size = std::min(max_saved, screenshot_filepaths.size());
608 std::partial_sort(screenshot_filepaths.begin(), 608 std::partial_sort(screenshot_filepaths.begin(),
609 screenshot_filepaths.begin() + sort_size, 609 screenshot_filepaths.begin() + sort_size,
610 screenshot_filepaths.end(), 610 screenshot_filepaths.end(),
611 ScreenshotTimestampComp); 611 ScreenshotTimestampComp);
612 for (size_t i = 0; i < sort_size; ++i) 612 for (size_t i = 0; i < sort_size; ++i)
613 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + 613 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) +
614 screenshot_filepaths[i]); 614 screenshot_filepaths[i]);
615 } 615 }
616 #endif 616 #endif
OLDNEW
« chrome/browser/resources/feedback.js ('K') | « 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