| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "ui/base/resource/resource_bundle.h" | 54 #include "ui/base/resource/resource_bundle.h" |
| 55 | 55 |
| 56 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
| 57 #include "ash/shell.h" | 57 #include "ash/shell.h" |
| 58 #include "ash/shell_delegate.h" | 58 #include "ash/shell_delegate.h" |
| 59 #include "base/file_util.h" | 59 #include "base/file_util.h" |
| 60 #include "base/path_service.h" | 60 #include "base/path_service.h" |
| 61 #include "chrome/browser/chromeos/cros/cros_library.h" | 61 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 62 #include "chrome/browser/chromeos/gdata/drive.pb.h" | 62 #include "chrome/browser/chromeos/gdata/drive.pb.h" |
| 63 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h" | 63 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h" |
| 64 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 64 #include "chrome/browser/chromeos/gdata/drive_system_service.h" |
| 65 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 65 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
| 66 #include "chrome/browser/chromeos/login/user_manager.h" | 66 #include "chrome/browser/chromeos/login/user_manager.h" |
| 67 #include "chrome/browser/chromeos/system/syslogs_provider.h" | 67 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
| 68 #include "ui/aura/root_window.h" | 68 #include "ui/aura/root_window.h" |
| 69 #include "ui/aura/window.h" | 69 #include "ui/aura/window.h" |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 using content::BrowserThread; | 72 using content::BrowserThread; |
| 73 using content::WebContents; | 73 using content::WebContents; |
| 74 using content::WebUIMessageHandler; | 74 using content::WebUIMessageHandler; |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::GDataSystemServiceFactory::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::ExtractGDataPath(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) { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |