OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/extensions/app_notify_channel_setup.h" | 10 #include "chrome/browser/extensions/app_notify_channel_setup.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // NOTE: this should only be manipulated before the tab is added to a browser. | 59 // NOTE: this should only be manipulated before the tab is added to a browser. |
60 // TODO(sky): resolve if this is the right way to identify an app tab. If it | 60 // TODO(sky): resolve if this is the right way to identify an app tab. If it |
61 // is, than this should be passed in the constructor. | 61 // is, than this should be passed in the constructor. |
62 void SetExtensionApp(const Extension* extension); | 62 void SetExtensionApp(const Extension* extension); |
63 | 63 |
64 // Convenience for setting the app extension by id. This does nothing if | 64 // Convenience for setting the app extension by id. This does nothing if |
65 // |extension_app_id| is empty, or an extension can't be found given the | 65 // |extension_app_id| is empty, or an extension can't be found given the |
66 // specified id. | 66 // specified id. |
67 void SetExtensionAppById(const std::string& extension_app_id); | 67 void SetExtensionAppById(const std::string& extension_app_id); |
68 | 68 |
| 69 // Set just the app icon, used by panels created by an extension. |
| 70 void SetExtensionAppIconById(const std::string& extension_app_id); |
| 71 |
69 const Extension* extension_app() const { return extension_app_; } | 72 const Extension* extension_app() const { return extension_app_; } |
70 bool is_app() const { return extension_app_ != NULL; } | 73 bool is_app() const { return extension_app_ != NULL; } |
71 const WebApplicationInfo& web_app_info() const { | 74 const WebApplicationInfo& web_app_info() const { |
72 return web_app_info_; | 75 return web_app_info_; |
73 } | 76 } |
74 | 77 |
75 // If an app extension has been explicitly set for this TabContents its icon | 78 // If an app extension has been explicitly set for this TabContents its icon |
76 // is returned. | 79 // is returned. |
77 // | 80 // |
78 // NOTE: the returned icon is larger than 16x16 (its size is | 81 // NOTE: the returned icon is larger than 16x16 (its size is |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 int return_route_id, | 117 int return_route_id, |
115 int callback_id); | 118 int callback_id); |
116 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 119 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
117 | 120 |
118 // App extensions related methods: | 121 // App extensions related methods: |
119 | 122 |
120 // Resets app_icon_ and if |extension| is non-null creates a new | 123 // Resets app_icon_ and if |extension| is non-null creates a new |
121 // ImageLoadingTracker to load the extension's image. | 124 // ImageLoadingTracker to load the extension's image. |
122 void UpdateExtensionAppIcon(const Extension* extension); | 125 void UpdateExtensionAppIcon(const Extension* extension); |
123 | 126 |
| 127 const Extension* GetExtension(const std::string& extension_app_id); |
| 128 |
124 // ImageLoadingTracker::Observer. | 129 // ImageLoadingTracker::Observer. |
125 virtual void OnImageLoaded(const gfx::Image& image, | 130 virtual void OnImageLoaded(const gfx::Image& image, |
126 const std::string& extension_id, | 131 const std::string& extension_id, |
127 int index) OVERRIDE; | 132 int index) OVERRIDE; |
128 | 133 |
129 // WebstoreInlineInstaller::Delegate. | 134 // WebstoreInlineInstaller::Delegate. |
130 virtual void OnInlineInstallSuccess(int install_id, | 135 virtual void OnInlineInstallSuccess(int install_id, |
131 int return_route_id) OVERRIDE; | 136 int return_route_id) OVERRIDE; |
132 virtual void OnInlineInstallFailure(int install_id, | 137 virtual void OnInlineInstallFailure(int install_id, |
133 int return_route_id, | 138 int return_route_id, |
(...skipping 26 matching lines...) Expand all Loading... |
160 | 165 |
161 // Cached web app info data. | 166 // Cached web app info data. |
162 WebApplicationInfo web_app_info_; | 167 WebApplicationInfo web_app_info_; |
163 | 168 |
164 TabContentsWrapper* wrapper_; | 169 TabContentsWrapper* wrapper_; |
165 | 170 |
166 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); | 171 DISALLOW_COPY_AND_ASSIGN(ExtensionTabHelper); |
167 }; | 172 }; |
168 | 173 |
169 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ | 174 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_H_ |
OLD | NEW |