| 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_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/task_management/providers/web_contents/renderer_task.h" | 8 #include "chrome/browser/task_management/providers/web_contents/renderer_task.h" |
| 9 #include "extensions/browser/extension_icon_image.h" |
| 9 #include "extensions/common/view_type.h" | 10 #include "extensions/common/view_type.h" |
| 10 | 11 |
| 11 namespace extensions { | 12 namespace extensions { |
| 12 class Extension; | 13 class Extension; |
| 13 } // namespace extensions | 14 } // namespace extensions |
| 14 | 15 |
| 15 namespace task_management { | 16 namespace task_management { |
| 16 | 17 |
| 17 // Defines a task manager representation for extensions. | 18 // Defines a task manager representation for extensions. |
| 18 class ExtensionTask : public RendererTask { | 19 class ExtensionTask |
| 20 : public RendererTask, |
| 21 public extensions::IconImage::Observer { |
| 19 public: | 22 public: |
| 20 ExtensionTask(content::WebContents* web_contents, | 23 ExtensionTask(content::WebContents* web_contents, |
| 21 const extensions::Extension* extension, | 24 const extensions::Extension* extension, |
| 22 extensions::ViewType view_type); | 25 extensions::ViewType view_type); |
| 23 ~ExtensionTask() override; | 26 ~ExtensionTask() override; |
| 24 | 27 |
| 25 // task_management::RendererTask: | 28 // task_management::RendererTask: |
| 26 void OnTitleChanged(content::NavigationEntry* entry) override; | 29 void OnTitleChanged(content::NavigationEntry* entry) override; |
| 27 void OnFaviconChanged() override; | 30 void OnFaviconChanged() override; |
| 28 Type GetType() const override; | 31 Type GetType() const override; |
| 29 | 32 |
| 33 // extensions::IconImage::Observer |
| 34 void OnExtensionIconImageChanged(extensions::IconImage* image) override; |
| 35 |
| 30 private: | 36 private: |
| 31 // If |extension| is nullptr, this method will get the title from | 37 // If |extension| is nullptr, this method will get the title from |
| 32 // the |web_contents|. | 38 // the |web_contents|. |
| 33 base::string16 GetExtensionTitle( | 39 base::string16 GetExtensionTitle( |
| 34 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
| 35 const extensions::Extension* extension, | 41 const extensions::Extension* extension, |
| 36 extensions::ViewType view_type) const; | 42 extensions::ViewType view_type) const; |
| 37 | 43 |
| 44 // This is called upon the creation of this task to load the extension icon |
| 45 // for the first time if any. |
| 46 void LoadExtensionIcon(const extensions::Extension* extension); |
| 47 |
| 48 // The favicon of the extension represented by this task. |
| 49 scoped_ptr<extensions::IconImage> extension_icon_; |
| 50 |
| 38 DISALLOW_COPY_AND_ASSIGN(ExtensionTask); | 51 DISALLOW_COPY_AND_ASSIGN(ExtensionTask); |
| 39 }; | 52 }; |
| 40 | 53 |
| 41 } // namespace task_management | 54 } // namespace task_management |
| 42 | 55 |
| 43 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_
H_ | 56 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_
H_ |
| OLD | NEW |