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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
8 #include "base/memory/weak_ptr.h"
9 #include "content/public/browser/url_data_source.h"
13 class ScreenlockIconProvider
;
15 // A URL data source that serves icon images for the screenlockPrivate API.
16 class ScreenlockIconSource
: public content::URLDataSource
{
18 explicit ScreenlockIconSource(
19 base::WeakPtr
<ScreenlockIconProvider
> icon_provider
);
21 // content::URLDataSource implementation.
22 std::string
GetSource() const override
;
23 void StartDataRequest(
24 const std::string
& path
,
25 int render_process_id
,
27 const content::URLDataSource::GotDataCallback
& callback
) override
;
29 std::string
GetMimeType(const std::string
& path
) const override
;
31 // Constructs and returns the icon URL for a given user.
32 static std::string
GetIconURLForUser(const std::string
& username
);
35 ~ScreenlockIconSource() override
;
37 base::WeakPtr
<ScreenlockIconProvider
> icon_provider_
;
39 DISALLOW_COPY_AND_ASSIGN(ScreenlockIconSource
);
42 } // namespace chromeos
44 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_