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

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

Issue 23739006: Fix potential SEGV issue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « no previous file | 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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "grit/locale_settings.h" 55 #include "grit/locale_settings.h"
56 #include "net/base/escape.h" 56 #include "net/base/escape.h"
57 #include "ui/base/resource/resource_bundle.h" 57 #include "ui/base/resource/resource_bundle.h"
58 58
59 #if defined(OS_CHROMEOS) 59 #if defined(OS_CHROMEOS)
60 #include "ash/shell.h" 60 #include "ash/shell.h"
61 #include "ash/shell_delegate.h" 61 #include "ash/shell_delegate.h"
62 #include "base/file_util.h" 62 #include "base/file_util.h"
63 #include "base/path_service.h" 63 #include "base/path_service.h"
64 #include "chrome/browser/chromeos/drive/drive.pb.h" 64 #include "chrome/browser/chromeos/drive/drive.pb.h"
65 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
66 #include "chrome/browser/chromeos/drive/file_system_interface.h" 65 #include "chrome/browser/chromeos/drive/file_system_interface.h"
67 #include "chrome/browser/chromeos/drive/file_system_util.h" 66 #include "chrome/browser/chromeos/drive/file_system_util.h"
68 #include "chrome/browser/chromeos/login/user_manager.h" 67 #include "chrome/browser/chromeos/login/user_manager.h"
69 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher_base.h" 68 #include "chrome/browser/chromeos/system_logs/system_logs_fetcher_base.h"
70 #include "ui/aura/root_window.h" 69 #include "ui/aura/root_window.h"
71 #include "ui/aura/window.h" 70 #include "ui/aura/window.h"
72 #endif 71 #endif
73 72
74 using content::BrowserThread; 73 using content::BrowserThread;
75 using content::WebContents; 74 using content::WebContents;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 ListValue screenshots_list; 574 ListValue screenshots_list;
576 for (size_t i = 0; i < saved_screenshots->size(); ++i) 575 for (size_t i = 0; i < saved_screenshots->size(); ++i)
577 screenshots_list.Append(new StringValue((*saved_screenshots)[i])); 576 screenshots_list.Append(new StringValue((*saved_screenshots)[i]));
578 web_ui()->CallJavascriptFunction("setupSavedScreenshots", screenshots_list); 577 web_ui()->CallJavascriptFunction("setupSavedScreenshots", screenshots_list);
579 } 578 }
580 579
581 void FeedbackHandler::GetMostRecentScreenshotsDrive( 580 void FeedbackHandler::GetMostRecentScreenshotsDrive(
582 const base::FilePath& filepath, std::vector<std::string>* saved_screenshots, 581 const base::FilePath& filepath, std::vector<std::string>* saved_screenshots,
583 size_t max_saved, base::Closure callback) { 582 size_t max_saved, base::Closure callback) {
584 drive::FileSystemInterface* file_system = 583 drive::FileSystemInterface* file_system =
585 drive::DriveIntegrationServiceFactory::GetForProfile( 584 drive::util::GetFileSystemByProfile(Profile::FromWebUI(web_ui()));
586 Profile::FromWebUI(web_ui()))->file_system(); 585 if (!file_system) {
586 callback.Run();
587 return;
588 }
589
587 file_system->ReadDirectoryByPath( 590 file_system->ReadDirectoryByPath(
588 drive::util::ExtractDrivePath(filepath), 591 drive::util::ExtractDrivePath(filepath),
589 base::Bind(&ReadDirectoryCallback, max_saved, saved_screenshots, 592 base::Bind(&ReadDirectoryCallback, max_saved, saved_screenshots,
590 callback)); 593 callback));
591 } 594 }
592 #endif 595 #endif
593 596
594 597
595 void FeedbackHandler::HandleSendReport(const ListValue* list_value) { 598 void FeedbackHandler::HandleSendReport(const ListValue* list_value) {
596 if (!feedback_data_.get()) { 599 if (!feedback_data_.get()) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 screenshot_filepaths.begin() + sort_size, 742 screenshot_filepaths.begin() + sort_size,
740 screenshot_filepaths.end(), 743 screenshot_filepaths.end(),
741 ScreenshotTimestampComp); 744 ScreenshotTimestampComp);
742 for (size_t i = 0; i < sort_size; ++i) 745 for (size_t i = 0; i < sort_size; ++i)
743 saved_screenshots->push_back( 746 saved_screenshots->push_back(
744 std::string(ScreenshotSource::kScreenshotUrlRoot) + 747 std::string(ScreenshotSource::kScreenshotUrlRoot) +
745 std::string(ScreenshotSource::kScreenshotSaved) + 748 std::string(ScreenshotSource::kScreenshotSaved) +
746 screenshot_filepaths[i]); 749 screenshot_filepaths[i]);
747 } 750 }
748 #endif 751 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698