• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 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_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
7 
8 #include "base/memory/weak_ptr.h"
9 #include "content/public/browser/url_data_source.h"
10 
11 namespace chromeos {
12 
13 class ScreenlockIconProvider;
14 
15 // A URL data source that serves icon images for the screenlockPrivate API.
16 class ScreenlockIconSource : public content::URLDataSource {
17  public:
18   explicit ScreenlockIconSource(
19       base::WeakPtr<ScreenlockIconProvider> icon_provider);
20 
21   // content::URLDataSource implementation.
22   virtual std::string GetSource() const OVERRIDE;
23   virtual void StartDataRequest(
24       const std::string& path,
25       int render_process_id,
26       int render_frame_id,
27       const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
28 
29   virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
30 
31   // Constructs and returns the icon URL for a given user.
32   static std::string GetIconURLForUser(const std::string& username);
33 
34  private:
35   virtual ~ScreenlockIconSource();
36 
37   base::WeakPtr<ScreenlockIconProvider> icon_provider_;
38 
39   DISALLOW_COPY_AND_ASSIGN(ScreenlockIconSource);
40 };
41 
42 }  // namespace chromeos
43 
44 #endif  // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
45