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

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

Issue 10905142: Rename GData to Drive in drive_file_system_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | 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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 554 }
555 555
556 #if defined(OS_CHROMEOS) 556 #if defined(OS_CHROMEOS)
557 void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) { 557 void FeedbackHandler::HandleRefreshSavedScreenshots(const ListValue*) {
558 std::vector<std::string>* saved_screenshots = new std::vector<std::string>; 558 std::vector<std::string>* saved_screenshots = new std::vector<std::string>;
559 FilePath filepath = DownloadPrefs::FromBrowserContext( 559 FilePath filepath = DownloadPrefs::FromBrowserContext(
560 tab_->GetBrowserContext())->DownloadPath(); 560 tab_->GetBrowserContext())->DownloadPath();
561 base::Closure refresh_callback = base::Bind( 561 base::Closure refresh_callback = base::Bind(
562 &FeedbackHandler::RefreshSavedScreenshotsCallback, 562 &FeedbackHandler::RefreshSavedScreenshotsCallback,
563 AsWeakPtr(), base::Owned(saved_screenshots)); 563 AsWeakPtr(), base::Owned(saved_screenshots));
564 if (gdata::util::IsUnderGDataMountPoint(filepath)) { 564 if (gdata::util::IsUnderDriveMountPoint(filepath)) {
565 GetMostRecentScreenshotsGData( 565 GetMostRecentScreenshotsGData(
566 filepath, saved_screenshots, kMaxSavedScreenshots, refresh_callback); 566 filepath, saved_screenshots, kMaxSavedScreenshots, refresh_callback);
567 } else { 567 } else {
568 BrowserThread::PostTaskAndReply( 568 BrowserThread::PostTaskAndReply(
569 BrowserThread::FILE, FROM_HERE, 569 BrowserThread::FILE, FROM_HERE,
570 base::Bind(&FeedbackUI::GetMostRecentScreenshots, filepath, 570 base::Bind(&FeedbackUI::GetMostRecentScreenshots, filepath,
571 base::Unretained(saved_screenshots), kMaxSavedScreenshots), 571 base::Unretained(saved_screenshots), kMaxSavedScreenshots),
572 refresh_callback); 572 refresh_callback);
573 } 573 }
574 } 574 }
575 575
576 void FeedbackHandler::RefreshSavedScreenshotsCallback( 576 void FeedbackHandler::RefreshSavedScreenshotsCallback(
577 std::vector<std::string>* saved_screenshots) { 577 std::vector<std::string>* saved_screenshots) {
578 ListValue screenshots_list; 578 ListValue screenshots_list;
579 for (size_t i = 0; i < saved_screenshots->size(); ++i) 579 for (size_t i = 0; i < saved_screenshots->size(); ++i)
580 screenshots_list.Append(new StringValue((*saved_screenshots)[i])); 580 screenshots_list.Append(new StringValue((*saved_screenshots)[i]));
581 web_ui()->CallJavascriptFunction("setupSavedScreenshots", screenshots_list); 581 web_ui()->CallJavascriptFunction("setupSavedScreenshots", screenshots_list);
582 } 582 }
583 583
584 void FeedbackHandler::GetMostRecentScreenshotsGData( 584 void FeedbackHandler::GetMostRecentScreenshotsGData(
585 const FilePath& filepath, std::vector<std::string>* saved_screenshots, 585 const FilePath& filepath, std::vector<std::string>* saved_screenshots,
586 size_t max_saved, base::Closure callback) { 586 size_t max_saved, base::Closure callback) {
587 gdata::DriveFileSystemInterface* file_system = 587 gdata::DriveFileSystemInterface* file_system =
588 gdata::DriveSystemServiceFactory::GetForProfile( 588 gdata::DriveSystemServiceFactory::GetForProfile(
589 Profile::FromWebUI(web_ui()))->file_system(); 589 Profile::FromWebUI(web_ui()))->file_system();
590 file_system->ReadDirectoryByPath( 590 file_system->ReadDirectoryByPath(
591 gdata::util::ExtractGDataPath(filepath), 591 gdata::util::ExtractDrivePath(filepath),
592 base::Bind(&ReadDirectoryCallback, max_saved, saved_screenshots, 592 base::Bind(&ReadDirectoryCallback, max_saved, saved_screenshots,
593 callback)); 593 callback));
594 } 594 }
595 #endif 595 #endif
596 596
597 597
598 void FeedbackHandler::HandleSendReport(const ListValue* list_value) { 598 void FeedbackHandler::HandleSendReport(const ListValue* list_value) {
599 if (!feedback_data_) { 599 if (!feedback_data_) {
600 LOG(ERROR) << "Bug report hasn't been intialized yet."; 600 LOG(ERROR) << "Bug report hasn't been intialized yet.";
601 return; 601 return;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); 747 size_t sort_size = std::min(max_saved, screenshot_filepaths.size());
748 std::partial_sort(screenshot_filepaths.begin(), 748 std::partial_sort(screenshot_filepaths.begin(),
749 screenshot_filepaths.begin() + sort_size, 749 screenshot_filepaths.begin() + sort_size,
750 screenshot_filepaths.end(), 750 screenshot_filepaths.end(),
751 ScreenshotTimestampComp); 751 ScreenshotTimestampComp);
752 for (size_t i = 0; i < sort_size; ++i) 752 for (size_t i = 0; i < sort_size; ++i)
753 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + 753 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) +
754 screenshot_filepaths[i]); 754 screenshot_filepaths[i]);
755 } 755 }
756 #endif 756 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698