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_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_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 "content/public/browser/url_data_source.h" | 13 #include "content/public/browser/url_data_source.h" |
14 #include "ui/base/layout.h" | 14 #include "ui/base/layout.h" |
15 | 15 |
16 class AccountId; | |
17 | |
18 namespace base { | 16 namespace base { |
19 class RefCountedMemory; | 17 class RefCountedMemory; |
20 } | 18 } |
21 | 19 |
22 namespace chromeos { | 20 namespace chromeos { |
23 namespace options { | 21 namespace options { |
24 | 22 |
25 // 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 |
26 // have it. | 24 // have it. |
27 class UserImageSource : public content::URLDataSource { | 25 class UserImageSource : public content::URLDataSource { |
28 public: | 26 public: |
29 UserImageSource(); | 27 UserImageSource(); |
30 | 28 |
31 // content::URLDataSource implementation. | 29 // content::URLDataSource implementation. |
32 std::string GetSource() const override; | 30 std::string GetSource() const override; |
33 void StartDataRequest( | 31 void StartDataRequest( |
34 const std::string& path, | 32 const std::string& path, |
35 int render_process_id, | 33 int render_process_id, |
36 int render_frame_id, | 34 int render_frame_id, |
37 const content::URLDataSource::GotDataCallback& callback) override; | 35 const content::URLDataSource::GotDataCallback& callback) override; |
38 std::string GetMimeType(const std::string& path) const override; | 36 std::string GetMimeType(const std::string& path) const override; |
39 | 37 |
40 // Returns PNG encoded image for user with specified |account_id|. If there's | 38 // Returns PNG encoded image for user with specified email. If there's |
41 // no user with such an id, returns the first default image. | 39 // no user with such email, returns the first default image. |
42 static base::RefCountedMemory* GetUserImage(const AccountId& account_id, | 40 static base::RefCountedMemory* GetUserImage(const std::string& email, |
43 ui::ScaleFactor scale_factor); | 41 ui::ScaleFactor scale_factor); |
44 | 42 |
45 private: | 43 private: |
46 ~UserImageSource() override; | 44 ~UserImageSource() override; |
47 | 45 |
48 DISALLOW_COPY_AND_ASSIGN(UserImageSource); | 46 DISALLOW_COPY_AND_ASSIGN(UserImageSource); |
49 }; | 47 }; |
50 | 48 |
51 } // namespace options | 49 } // namespace options |
52 } // namespace chromeos | 50 } // namespace chromeos |
53 | 51 |
54 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_ | 52 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_ |
OLD | NEW |