blob: fbe44aabcb06b58c91712a1ff06d53590f1fcab9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2012 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_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_
#define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_
#include <map>
#include <string>
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
class Profile;
namespace extensions {
class Extension;
}
// Default implementation of LauncherUpdater::AppIconLoader that interacts
// with the ExtensionService and ImageLoadingTracker to load images.
class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader,
public ImageLoadingTracker::Observer {
public:
LauncherAppIconLoader(Profile* profile, ChromeLauncherController* host);
virtual ~LauncherAppIconLoader();
// AppIconLoader:
virtual void FetchImage(const std::string& id) OVERRIDE;
// ImageLoadingTracker::Observer:
virtual void OnImageLoaded(const gfx::Image& image,
const std::string& extension_id,
int index) OVERRIDE;
private:
typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap;
Profile* profile_;
// ChromeLauncherController we're associated with (and owned by).
ChromeLauncherController* host_;
// Used to load images.
scoped_ptr<ImageLoadingTracker> image_loader_;
// Maps from id from the ImageLoadingTracker to the extension id.
ImageLoaderIDToExtensionIDMap map_;
DISALLOW_COPY_AND_ASSIGN(LauncherAppIconLoader);
};
#endif // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_APP_ICON_LOADER_H_
|