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

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

Issue 10908081: Refactor screenshot directory source (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include cleanup 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/ash/screenshot_taker.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) 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/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
15 15
16 #if defined(OS_CHROMEOS) 16 #if defined(OS_CHROMEOS)
17 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" 17 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h"
18 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" 18 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h"
19 #include "chrome/browser/chromeos/gdata/gdata_util.h"
20 #include "chrome/browser/chromeos/login/user_manager.h"
Jun Mukai 2012/09/06 09:30:06 These files seem not referred in the header file.
19 #endif 21 #endif
20 22
21 typedef std::vector<unsigned char> ScreenshotData; 23 typedef std::vector<unsigned char> ScreenshotData;
22 typedef linked_ptr<ScreenshotData> ScreenshotDataPtr; 24 typedef linked_ptr<ScreenshotData> ScreenshotDataPtr;
23 25
24 class FilePath; 26 class FilePath;
25 class Profile; 27 class Profile;
26 28
27 // ScreenshotSource is the data source that serves screenshots (saved 29 // ScreenshotSource is the data source that serves screenshots (saved
28 // or current) to the bug report html ui. 30 // or current) to the bug report html ui.
29 class ScreenshotSource : public ChromeURLDataManager::DataSource { 31 class ScreenshotSource : public ChromeURLDataManager::DataSource {
30 public: 32 public:
31 explicit ScreenshotSource( 33 explicit ScreenshotSource(
32 std::vector<unsigned char>* current_screenshot, 34 std::vector<unsigned char>* current_screenshot,
33 Profile* profile); 35 Profile* profile);
34 36
37 // Queries the browser process to determine if screenshots are disabled.
38 static bool AreScreenshotsDisabled();
39 // Get the basefilename for screenshots
40 static std::string GetScreenshotBaseFilename();
41 // Common access for the screenshot directory, parameter is set to the
42 // requested directory and return value of true is given upon success.
43 static bool GetScreenshotDirectory(FilePath* directory);
44
35 // Called when the network layer has requested a resource underneath 45 // Called when the network layer has requested a resource underneath
36 // the path we registered. 46 // the path we registered.
37 virtual void StartDataRequest(const std::string& path, 47 virtual void StartDataRequest(const std::string& path,
38 bool is_incognito, 48 bool is_incognito,
39 int request_id) OVERRIDE; 49 int request_id) OVERRIDE;
40 50
41 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 51 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
42 52
43 // Get the screenshot specified by the given relative path that we've cached 53 // Get the screenshot specified by the given relative path that we've cached
44 // from a previous request to the screenshots source. 54 // from a previous request to the screenshots source.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 Profile* profile_; 91 Profile* profile_;
82 92
83 // Key: Relative path to the screenshot (including filename) 93 // Key: Relative path to the screenshot (including filename)
84 // Value: Pointer to the screenshot data associated with the path. 94 // Value: Pointer to the screenshot data associated with the path.
85 std::map<std::string, ScreenshotDataPtr> cached_screenshots_; 95 std::map<std::string, ScreenshotDataPtr> cached_screenshots_;
86 96
87 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource); 97 DISALLOW_COPY_AND_ASSIGN(ScreenshotSource);
88 }; 98 };
89 99
90 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_ 100 #endif // CHROME_BROWSER_UI_WEBUI_SCREENSHOT_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/screenshot_taker.cc ('k') | chrome/browser/ui/webui/screenshot_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698