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 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_USER_IMAGE_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_USER_IMAGE_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_USER_IMAGE_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_USER_IMAGE_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 14 #include "ui/base/layout.h" |
| 15 |
| 16 namespace base { |
| 17 class RefCountedMemory; |
| 18 } |
14 | 19 |
15 namespace chromeos { | 20 namespace chromeos { |
16 namespace options2 { | 21 namespace options2 { |
17 | 22 |
18 // UserImageSource is the data source that serves user images for users that | 23 // UserImageSource is the data source that serves user images for users that |
19 // have it. | 24 // have it. |
20 class UserImageSource : public ChromeURLDataManager::DataSource { | 25 class UserImageSource : public ChromeURLDataManager::DataSource { |
21 public: | 26 public: |
22 UserImageSource(); | 27 UserImageSource(); |
23 | 28 |
24 // Called when the network layer has requested a resource underneath | 29 // Called when the network layer has requested a resource underneath |
25 // the path we registered. | 30 // the path we registered. |
26 virtual void StartDataRequest(const std::string& path, | 31 virtual void StartDataRequest(const std::string& path, |
27 bool is_incognito, | 32 bool is_incognito, |
28 int request_id) OVERRIDE; | 33 int request_id) OVERRIDE; |
29 | 34 |
30 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; | 35 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; |
31 | 36 |
32 // Returns PNG or GIF (when possible and if |is_image_animated| flag | 37 // Returns PNG or GIF (when possible and if |is_image_animated| flag |
33 // is true) encoded image for user with specified email. If there's | 38 // is true) encoded image for user with specified email. If there's |
34 // no user with such email, returns the default image. | 39 // no user with such email, returns the first default image. |
35 std::vector<unsigned char> GetUserImage(const std::string& email, | 40 base::RefCountedMemory* GetUserImage(const std::string& email, |
36 bool is_image_animated) const; | 41 bool is_image_animated, |
| 42 ui::ScaleFactor scale_factor) const; |
37 | 43 |
38 private: | 44 private: |
39 virtual ~UserImageSource(); | 45 virtual ~UserImageSource(); |
40 | 46 |
41 DISALLOW_COPY_AND_ASSIGN(UserImageSource); | 47 DISALLOW_COPY_AND_ASSIGN(UserImageSource); |
42 }; | 48 }; |
43 | 49 |
44 } // namespace options2 | 50 } // namespace options2 |
45 } // namespace chromeos | 51 } // namespace chromeos |
46 | 52 |
47 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_USER_IMAGE_SOURCE_H_ | 53 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_USER_IMAGE_SOURCE_H_ |
OLD | NEW |