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

Unified Diff: chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.h

Issue 1200543003: Migrate LauncherSearchResult to use SetBadgeIcon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CHECK -> DCHECK. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.h
diff --git a/chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.h b/chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.h
deleted file mode 100644
index 380dbe0ce773464edabb1e1f463267e5b9b8eb9a..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2015 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_APP_LIST_SEARCH_LAUNCHER_SEARCH_EXTENSION_BADGED_ICON_IMAGE_H_
-#define CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_EXTENSION_BADGED_ICON_IMAGE_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h"
-#include "chrome/browser/profiles/profile.h"
-#include "extensions/common/extension.h"
-#include "ui/gfx/image/image.h"
-#include "ui/gfx/image/image_skia.h"
-#include "url/gurl.h"
-
-namespace app_list {
-
-// Provides an icon image which is badged with extension icon. If custom icon
-// image is not specified, extension icon will be used.
-class ExtensionBadgedIconImage {
- public:
- class Observer {
- public:
- // Called when icon image is changed. To obtain the new image, call
- // GetIconImage method.
- virtual void OnIconImageChanged(ExtensionBadgedIconImage* image) = 0;
- };
-
- // If |custom_icon_url| is empty, uses the extension icon.
- ExtensionBadgedIconImage(
- const GURL& custom_icon_url,
- Profile* profile,
- const extensions::Extension* extension,
- const int icon_dimension,
- scoped_ptr<chromeos::launcher_search_provider::ErrorReporter>
- error_reporter);
- virtual ~ExtensionBadgedIconImage();
-
- // Load resources caller must call this function to generate icon image.
- void LoadResources();
-
- // Adds |observer| to listen icon image changed event. To get fresh icon
- // image, you need to add observer before you call GetIconImage.
- void AddObserver(Observer* observer);
-
- // Removes |observer|.
- void RemoveObserver(Observer* observer);
-
- // Returns badged icon image
- const gfx::ImageSkia& GetIconImage() const;
-
- protected:
- // Loads |extension| icon and returns it as sync if possible. When it loads
- // icon as async, it calls OnExtensionIconImageChanged.
- virtual const gfx::ImageSkia& LoadExtensionIcon() = 0;
-
- // Loads |icon_url_| as async. When it loads an image, OnCustomIconLoaded will
- // be called with an image. When it fails to load an image, OnCustomIconLoaded
- // will be called with an empty image.
- virtual void LoadIconResourceFromExtension() = 0;
-
- // Called when extension icon image is changed.
- void OnExtensionIconChanged(const gfx::ImageSkia& image);
-
- // Called when custom icon image is loaded.
- void OnCustomIconLoaded(const gfx::ImageSkia& image);
-
- Profile* profile_;
- const extensions::Extension* extension_;
- const GURL icon_url_;
- const gfx::Size icon_size_;
-
- private:
- // Updates icon image.
- void Update();
-
- // Sets new icon image, and notify to observers.
- void SetIconImage(const gfx::ImageSkia& image);
-
- // Returns truncated icon url. Since max_size includes trailing ..., it should
- // be larger than 3.
- std::string GetTruncatedIconUrl(const uint32 max_size);
-
- gfx::ImageSkia extension_icon_image_;
- gfx::ImageSkia custom_icon_image_;
- gfx::ImageSkia badged_icon_image_;
-
- scoped_ptr<chromeos::launcher_search_provider::ErrorReporter> error_reporter_;
- std::set<Observer*> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(ExtensionBadgedIconImage);
-};
-
-} // namespace app_list
-
-#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_EXTENSION_BADGED_ICON_IMAGE_H_
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/search/launcher_search/extension_badged_icon_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698