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

Side by Side Diff: extensions/browser/extension_icon_placeholder.h

Issue 1131443006: [Extensions UI] Add a placeholder icon for extensions in the toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finnur's Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2015 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 EXTENSIONS_BROWSER_EXTENSION_ICON_PLACEHOLDER_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_ICON_PLACEHOLDER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/strings/string16.h"
12 #include "extensions/common/constants.h"
13 #include "ui/gfx/image/canvas_image_source.h"
14 #include "ui/gfx/image/image.h"
15
16 namespace gfx {
17 class Canvas;
18 class Size;
19 }
20
21 namespace extensions {
22
23 // An extension icon image with a gray background and the first letter of the
24 // extension name, so that not all extensions without an icon look the same.
25 class ExtensionIconPlaceholder : public gfx::CanvasImageSource {
26 public:
27 ExtensionIconPlaceholder(extension_misc::ExtensionIcons size,
28 const std::string& name);
29 ~ExtensionIconPlaceholder() override;
30
31 // Creates an image backed by an ImageSkia with the ExtensionIconPlaceholder
32 // as its image source.
33 static gfx::Image CreateImage(extension_misc::ExtensionIcons size,
34 const std::string& name);
35
36 private:
37 // gfx::CanvasImageSource:
38 void Draw(gfx::Canvas* canvas) override;
39
40 // The size this placeholder is filling.
41 extension_misc::ExtensionIcons icon_size_;
42
43 // The first letter of the extension's name.
44 base::string16 letter_;
45
46 // The gray background image, on top of which the letter is drawn.
47 gfx::Image base_image_;
48
49 DISALLOW_COPY_AND_ASSIGN(ExtensionIconPlaceholder);
50 };
51
52 } // namespace extensions
53
54 #endif // EXTENSIONS_BROWSER_EXTENSION_ICON_PLACEHOLDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action.cc ('k') | extensions/browser/extension_icon_placeholder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698