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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "content/public/browser/url_data_source.h" 15 #include "content/public/browser/url_data_source.h"
16 16
17 #if defined(OS_CHROMEOS) 17 #if defined(OS_CHROMEOS)
18 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" 18 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h"
19 #include "chrome/browser/chromeos/login/user_manager.h" 19 #include "chrome/browser/chromeos/login/user_manager.h"
20 #include "chrome/browser/google_apis/gdata_errorcode.h" 20 #include "chrome/browser/google_apis/gdata_errorcode.h"
21 #endif 21 #endif
22 22
23 typedef std::vector<unsigned char> ScreenshotData; 23 typedef std::vector<unsigned char> ScreenshotData;
24 typedef linked_ptr<ScreenshotData> ScreenshotDataPtr; 24 typedef linked_ptr<ScreenshotData> ScreenshotDataPtr;
25 25
26 class Profile;
27
28 namespace base {
26 class FilePath; 29 class FilePath;
27 class Profile; 30 }
28 31
29 // ScreenshotSource is the data source that serves screenshots (saved 32 // ScreenshotSource is the data source that serves screenshots (saved
30 // or current) to the bug report html ui. 33 // or current) to the bug report html ui.
31 class ScreenshotSource : public content::URLDataSource { 34 class ScreenshotSource : public content::URLDataSource {
32 public: 35 public:
33 explicit ScreenshotSource( 36 explicit ScreenshotSource(
34 std::vector<unsigned char>* current_screenshot, 37 std::vector<unsigned char>* current_screenshot,
35 Profile* profile); 38 Profile* profile);
36 39
37 #if defined(USE_ASH) 40 #if defined(USE_ASH)
38 // Queries the browser process to determine if screenshots are disabled. 41 // Queries the browser process to determine if screenshots are disabled.
39 static bool AreScreenshotsDisabled(); 42 static bool AreScreenshotsDisabled();
40 43
41 // Common access for the screenshot directory, parameter is set to the 44 // Common access for the screenshot directory, parameter is set to the
42 // requested directory and return value of true is given upon success. 45 // requested directory and return value of true is given upon success.
43 static bool GetScreenshotDirectory(FilePath* directory); 46 static bool GetScreenshotDirectory(base::FilePath* directory);
44 #endif 47 #endif
45 48
46 // Get the basefilename for screenshots 49 // Get the basefilename for screenshots
47 static std::string GetScreenshotBaseFilename(); 50 static std::string GetScreenshotBaseFilename();
48 51
49 // content::URLDataSource implementation. 52 // content::URLDataSource implementation.
50 virtual std::string GetSource() OVERRIDE; 53 virtual std::string GetSource() OVERRIDE;
51 virtual void StartDataRequest( 54 virtual void StartDataRequest(
52 const std::string& path, 55 const std::string& path,
53 bool is_incognito, 56 bool is_incognito,
(...skipping 28 matching lines...) Expand all
82 // All calls to send a screenshot should only call this method. 85 // All calls to send a screenshot should only call this method.
83 // Note: This method strips the query string from the given path. 86 // Note: This method strips the query string from the given path.
84 void SendScreenshot(const std::string& screenshot_path, 87 void SendScreenshot(const std::string& screenshot_path,
85 const content::URLDataSource::GotDataCallback& callback); 88 const content::URLDataSource::GotDataCallback& callback);
86 #if defined(OS_CHROMEOS) 89 #if defined(OS_CHROMEOS)
87 // Send a saved screenshot image file specified by the given screenshot path 90 // Send a saved screenshot image file specified by the given screenshot path
88 // to the requestor. 91 // to the requestor.
89 void SendSavedScreenshot( 92 void SendSavedScreenshot(
90 const std::string& screenshot_path, 93 const std::string& screenshot_path,
91 const content::URLDataSource::GotDataCallback& callback, 94 const content::URLDataSource::GotDataCallback& callback,
92 const FilePath& file); 95 const base::FilePath& file);
93 96
94 // The callback for Drive's getting file method. 97 // The callback for Drive's getting file method.
95 void GetSavedScreenshotCallback( 98 void GetSavedScreenshotCallback(
96 const std::string& screenshot_path, 99 const std::string& screenshot_path,
97 const content::URLDataSource::GotDataCallback& callback, 100 const content::URLDataSource::GotDataCallback& callback,
98 drive::DriveFileError error, 101 drive::DriveFileError error,
99 const FilePath& file, 102 const base::FilePath& file,
100 const std::string& unused_mime_type, 103 const std::string& unused_mime_type,
101 drive::DriveFileType file_type); 104 drive::DriveFileType file_type);
102 105
103 #endif 106 #endif
104 // Sends the screenshot data to the requestor while caching it locally to the 107 // Sends the screenshot data to the requestor while caching it locally to the
105 // class instance, indexed by path. 108 // class instance, indexed by path.
106 void CacheAndSendScreenshot( 109 void CacheAndSendScreenshot(
107 const std::string& screenshot_path, 110 const std::string& screenshot_path,
108 const content::URLDataSource::GotDataCallback& callback, 111 const content::URLDataSource::GotDataCallback& callback,
109 ScreenshotDataPtr bytes); 112 ScreenshotDataPtr bytes);
110 113
111 // Pointer to the screenshot data for the current screenshot. 114 // Pointer to the screenshot data for the current screenshot.
112 ScreenshotDataPtr current_screenshot_; 115 ScreenshotDataPtr current_screenshot_;
113 116
114 Profile* profile_; 117 Profile* profile_;
115 118
116 // Key: Relative path to the screenshot (including filename) 119 // Key: Relative path to the screenshot (including filename)
117 // Value: Pointer to the screenshot data associated with the path. 120 // Value: Pointer to the screenshot data associated with the path.
118 std::map<std::string, ScreenshotDataPtr> cached_screenshots_; 121 std::map<std::string, ScreenshotDataPtr> cached_screenshots_;
119 122
120 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource); 123 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource);
121 }; 124 };
122 125
123 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ 126 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/sticky_settings.h ('k') | chrome/browser/value_store/value_store_frontend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698