blob: 3d4bdf60a70cb6a0700cfb73134893f5456c544b [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_
#include "base/memory/weak_ptr.h"
#include "content/public/browser/url_data_source.h"
namespace chromeos {
class ScreenlockIconProvider;
// A URL data source that serves icon images for the screenlockPrivate API.
class ScreenlockIconSource : public content::URLDataSource {
public:
explicit ScreenlockIconSource(
base::WeakPtr<ScreenlockIconProvider> icon_provider);
// content::URLDataSource implementation.
virtual std::string GetSource() const OVERRIDE;
virtual void StartDataRequest(
const std::string& path,
int render_process_id,
int render_frame_id,
const content::URLDataSource::GotDataCallback& callback) OVERRIDE;
virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
// Constructs and returns the icon URL for a given user.
static std::string GetIconURLForUser(const std::string& username);
private:
virtual ~ScreenlockIconSource();
base::WeakPtr<ScreenlockIconProvider> icon_provider_;
DISALLOW_COPY_AND_ASSIGN(ScreenlockIconSource);
};
} // namespace chromeos
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SCREENLOCK_ICON_SOURCE_H_