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

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

Issue 10874028: Rename GDataFileSystem* to DriveFileSystem* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remaining manual changes 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
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/screenshot_source.h" 5 #include "chrome/browser/ui/webui/screenshot_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "chrome/browser/download/download_prefs.h" 15 #include "chrome/browser/download/download_prefs.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
18 #include "googleurl/src/url_canon.h" 18 #include "googleurl/src/url_canon.h"
19 #include "googleurl/src/url_util.h" 19 #include "googleurl/src/url_util.h"
20 20
21 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
22 #include "ash/shell.h" 22 #include "ash/shell.h"
23 #include "ash/shell_delegate.h" 23 #include "ash/shell_delegate.h"
24 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" 24 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h"
25 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 25 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
26 #include "chrome/browser/chromeos/gdata/gdata_util.h" 26 #include "chrome/browser/chromeos/gdata/gdata_util.h"
27 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
28 #endif 28 #endif
29 29
30 static const char kCurrentScreenshotFilename[] = "current"; 30 static const char kCurrentScreenshotFilename[] = "current";
31 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
32 static const char kSavedScreenshotsBasePath[] = "saved/"; 32 static const char kSavedScreenshotsBasePath[] = "saved/";
33 #endif 33 #endif
34 34
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 url_util::DecodeURLEscapeSequences( 88 url_util::DecodeURLEscapeSequences(
89 filename.data(), filename.size(), &decoded); 89 filename.data(), filename.size(), &decoded);
90 // Screenshot filenames don't use non-ascii characters. 90 // Screenshot filenames don't use non-ascii characters.
91 std::string decoded_filename = UTF16ToASCII(string16( 91 std::string decoded_filename = UTF16ToASCII(string16(
92 decoded.data(), decoded.length())); 92 decoded.data(), decoded.length()));
93 93
94 DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( 94 DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(
95 ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); 95 ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext());
96 FilePath download_path = download_prefs->DownloadPath(); 96 FilePath download_path = download_prefs->DownloadPath();
97 if (gdata::util::IsUnderGDataMountPoint(download_path)) { 97 if (gdata::util::IsUnderGDataMountPoint(download_path)) {
98 gdata::GDataFileSystemInterface* file_system = 98 gdata::DriveFileSystemInterface* file_system =
99 gdata::GDataSystemServiceFactory::GetForProfile( 99 gdata::GDataSystemServiceFactory::GetForProfile(
100 profile_)->file_system(); 100 profile_)->file_system();
101 file_system->GetFileByResourceId( 101 file_system->GetFileByResourceId(
102 decoded_filename, 102 decoded_filename,
103 base::Bind(&ScreenshotSource::GetSavedScreenshotCallback, 103 base::Bind(&ScreenshotSource::GetSavedScreenshotCallback,
104 base::Unretained(this), screenshot_path, request_id), 104 base::Unretained(this), screenshot_path, request_id),
105 gdata::GetContentCallback()); 105 gdata::GetContentCallback());
106 } else { 106 } else {
107 BrowserThread::PostTask( 107 BrowserThread::PostTask(
108 BrowserThread::FILE, FROM_HERE, 108 BrowserThread::FILE, FROM_HERE,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 #endif 160 #endif
161 161
162 void ScreenshotSource::CacheAndSendScreenshot( 162 void ScreenshotSource::CacheAndSendScreenshot(
163 const std::string& screenshot_path, 163 const std::string& screenshot_path,
164 int request_id, 164 int request_id,
165 ScreenshotDataPtr bytes) { 165 ScreenshotDataPtr bytes) {
166 cached_screenshots_[screenshot_path] = bytes; 166 cached_screenshots_[screenshot_path] = bytes;
167 SendResponse(request_id, new base::RefCountedBytes(*bytes)); 167 SendResponse(request_id, new base::RefCountedBytes(*bytes));
168 } 168 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698