| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_ICON_I
MAGE_LOADER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_ICON_I
MAGE_LOADER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_ICON_I
MAGE_LOADER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_ICON_I
MAGE_LOADER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" | 13 #include "chrome/browser/chromeos/launcher_search_provider/error_reporter.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
| 15 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
| 16 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace app_list { | 20 namespace app_list { |
| 20 | 21 |
| 21 // Loads icons of launcher search results. | 22 // Loads icons of launcher search results. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 virtual void OnBadgeIconImageChanged( | 34 virtual void OnBadgeIconImageChanged( |
| 34 LauncherSearchIconImageLoader* image_loader) = 0; | 35 LauncherSearchIconImageLoader* image_loader) = 0; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 // If |custom_icon_url| is empty, uses the extension icon. | 38 // If |custom_icon_url| is empty, uses the extension icon. |
| 38 LauncherSearchIconImageLoader( | 39 LauncherSearchIconImageLoader( |
| 39 const GURL& custom_icon_url, | 40 const GURL& custom_icon_url, |
| 40 Profile* profile, | 41 Profile* profile, |
| 41 const extensions::Extension* extension, | 42 const extensions::Extension* extension, |
| 42 const int icon_dimension, | 43 const int icon_dimension, |
| 43 scoped_ptr<chromeos::launcher_search_provider::ErrorReporter> | 44 std::unique_ptr<chromeos::launcher_search_provider::ErrorReporter> |
| 44 error_reporter); | 45 error_reporter); |
| 45 virtual ~LauncherSearchIconImageLoader(); | 46 virtual ~LauncherSearchIconImageLoader(); |
| 46 | 47 |
| 47 // Load resources caller must call this function to generate icon image. | 48 // Load resources caller must call this function to generate icon image. |
| 48 void LoadResources(); | 49 void LoadResources(); |
| 49 | 50 |
| 50 // Adds |observer| to listen icon image changed event. To get fresh icon | 51 // Adds |observer| to listen icon image changed event. To get fresh icon |
| 51 // image, you need to add observer before you call GetIconImage. | 52 // image, you need to add observer before you call GetIconImage. |
| 52 void AddObserver(Observer* observer); | 53 void AddObserver(Observer* observer); |
| 53 | 54 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 // Notifies to observers. | 86 // Notifies to observers. |
| 86 void NotifyObserversIconImageChange(); | 87 void NotifyObserversIconImageChange(); |
| 87 void NotifyObserversBadgeIconImageChange(); | 88 void NotifyObserversBadgeIconImageChange(); |
| 88 | 89 |
| 89 // Returns truncated icon url. Since max_size includes trailing ..., it should | 90 // Returns truncated icon url. Since max_size includes trailing ..., it should |
| 90 // be larger than 3. | 91 // be larger than 3. |
| 91 std::string GetTruncatedIconUrl(const uint32_t max_size); | 92 std::string GetTruncatedIconUrl(const uint32_t max_size); |
| 92 | 93 |
| 93 scoped_ptr<chromeos::launcher_search_provider::ErrorReporter> error_reporter_; | 94 std::unique_ptr<chromeos::launcher_search_provider::ErrorReporter> |
| 95 error_reporter_; |
| 94 | 96 |
| 95 gfx::ImageSkia extension_icon_image_; | 97 gfx::ImageSkia extension_icon_image_; |
| 96 gfx::ImageSkia custom_icon_image_; | 98 gfx::ImageSkia custom_icon_image_; |
| 97 | 99 |
| 98 std::set<Observer*> observers_; | 100 std::set<Observer*> observers_; |
| 99 | 101 |
| 100 DISALLOW_COPY_AND_ASSIGN(LauncherSearchIconImageLoader); | 102 DISALLOW_COPY_AND_ASSIGN(LauncherSearchIconImageLoader); |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 } // namespace app_list | 105 } // namespace app_list |
| 104 | 106 |
| 105 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_ICO
N_IMAGE_LOADER_H_ | 107 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_LAUNCHER_SEARCH_LAUNCHER_SEARCH_ICO
N_IMAGE_LOADER_H_ |
| OLD | NEW |