Home | History | Annotate | Download | only in chromeos
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_
      6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_
      7 #pragma once
      8 
      9 #include <string>
     10 #include <vector>
     11 
     12 #include "base/basictypes.h"
     13 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
     14 
     15 namespace chromeos {
     16 
     17 // UserImageSource is the data source that serves user images for users that
     18 // have it.
     19 class UserImageSource : public ChromeURLDataManager::DataSource {
     20  public:
     21   UserImageSource();
     22 
     23   // Called when the network layer has requested a resource underneath
     24   // the path we registered.
     25   virtual void StartDataRequest(const std::string& path,
     26                                 bool is_incognito,
     27                                 int request_id);
     28 
     29   virtual std::string GetMimeType(const std::string&) const;
     30 
     31   // Returns PNG encoded image for user with specified email.
     32   // If there's no user with such email, returns the default image.
     33   std::vector<unsigned char> GetUserImage(const std::string& email) const;
     34 
     35  private:
     36   virtual ~UserImageSource();
     37 
     38   DISALLOW_COPY_AND_ASSIGN(UserImageSource);
     39 };
     40 
     41 }  // namespace chromeos
     42 
     43 #endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_USER_IMAGE_SOURCE_H_
     44