Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/ui/views/aura/launcher/launcher_icon_loader.h

Issue 9570044: Rename chrome/browser/ui/views/{aura => ash}/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_VIEWS_AURA_LAUNCHER_LAUNCHER_ICON_LOADER_H_
6 #define CHROME_BROWSER_UI_VIEWS_AURA_LAUNCHER_LAUNCHER_ICON_LOADER_H_
7 #pragma once
8
9 #include <map>
10 #include <string>
11
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/image_loading_tracker.h"
14 #include "chrome/browser/ui/views/aura/launcher/chrome_launcher_delegate.h"
15
16 class Extension;
17 class Profile;
18
19 // Default implementation of LauncherUpdater::AppIconLoader that interacts
20 // with the ExtensionService and ImageLoadingTracker to load images.
21 class LauncherIconLoader : public ChromeLauncherDelegate::AppIconLoader,
22 public ImageLoadingTracker::Observer {
23 public:
24 LauncherIconLoader(Profile* profile, ChromeLauncherDelegate* host);
25 virtual ~LauncherIconLoader();
26
27 // AppIconLoader:
28 virtual std::string GetAppID(TabContentsWrapper* tab) OVERRIDE;
29 virtual bool IsValidID(const std::string& id) OVERRIDE;
30 virtual void FetchImage(const std::string& id) OVERRIDE;
31
32 // ImageLoadingTracker::Observer:
33 virtual void OnImageLoaded(SkBitmap* image,
34 const ExtensionResource& resource,
35 int index) OVERRIDE;
36
37 private:
38 typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap;
39
40 // Returns the extension for the specified tab.
41 const Extension* GetExtensionForTab(TabContentsWrapper* tab);
42
43 // Returns the extension by ID.
44 const Extension* GetExtensionByID(const std::string& id);
45
46 Profile* profile_;
47
48 // ChromeLauncherDelegate we're associated with (and owned by).
49 ChromeLauncherDelegate* host_;
50
51 // Used to load images.
52 scoped_ptr<ImageLoadingTracker> image_loader_;
53
54 // Maps from id from the ImageLoadingTracker to the extension id.
55 ImageLoaderIDToExtensionIDMap map_;
56
57 DISALLOW_COPY_AND_ASSIGN(LauncherIconLoader);
58 };
59
60 #endif // CHROME_BROWSER_UI_VIEWS_AURA_LAUNCHER_LAUNCHER_ICON_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698