OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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 CHROME_BROWSER_UI_APP_LIST_ARC_APP_ITEM_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_APP_ITEM_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "ui/app_list/app_list_item.h" |
| 12 #include "ui/base/layout.h" |
| 13 #include "ui/gfx/image/image.h" |
| 14 #include "ui/gfx/image/image_skia.h" |
| 15 |
| 16 class Profile; |
| 17 |
| 18 namespace base { |
| 19 class FilePath; |
| 20 } |
| 21 |
| 22 namespace content { |
| 23 class BrowserContext; |
| 24 } |
| 25 |
| 26 // ArcAppItem represents an Arc app in app list. |
| 27 class ArcAppItem : public app_list::AppListItem { |
| 28 public: |
| 29 static const char kItemType[]; |
| 30 |
| 31 ArcAppItem(content::BrowserContext* context, |
| 32 const std::string& id, |
| 33 const std::string& name, |
| 34 bool ready); |
| 35 ~ArcAppItem() override; |
| 36 |
| 37 void SetName(const std::string& name); |
| 38 |
| 39 void Activate(int event_flags) override; |
| 40 const char* GetItemType() const override; |
| 41 |
| 42 void SetReady(bool ready); |
| 43 void UpdateIcon(ui::ScaleFactor scale_factor, const base::FilePath& path); |
| 44 |
| 45 private: |
| 46 content::BrowserContext* context_; |
| 47 bool ready_; |
| 48 gfx::ImageSkia image_skia_; |
| 49 gfx::Image image_; |
| 50 |
| 51 base::WeakPtrFactory<ArcAppItem> weak_ptr_factory_; |
| 52 |
| 53 void UpdateIcon(); |
| 54 void UpdateIcon(const gfx::ImageSkia* image); |
| 55 void UpdateIconOnBlockingThread(ui::ScaleFactor scale_factor, |
| 56 const base::FilePath& path); |
| 57 void OnIconLoaded(const gfx::Image& image_in); |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ArcAppItem); |
| 60 }; |
| 61 |
| 62 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_APP_ITEM_H_ |
OLD | NEW |