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 #include "chrome/browser/extensions/extension_action.h" | 5 #include "chrome/browser/extensions/extension_action.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 }; | 51 }; |
52 | 52 |
53 template <class T> | 53 template <class T> |
54 bool HasValue(const std::map<int, T>& map, int tab_id) { | 54 bool HasValue(const std::map<int, T>& map, int tab_id) { |
55 return map.find(tab_id) != map.end(); | 55 return map.find(tab_id) != map.end(); |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 const int ExtensionAction::kDefaultTabId = -1; | 60 const int ExtensionAction::kDefaultTabId = -1; |
61 const int ExtensionAction::kPageActionIconMaxSize = 19; | 61 const int ExtensionAction::kPageActionIconMaxSize = |
| 62 extension_misc::EXTENSION_ICON_ACTION; |
62 | 63 |
63 ExtensionAction::ExtensionAction(const std::string& extension_id, | 64 ExtensionAction::ExtensionAction(const std::string& extension_id, |
64 extensions::ActionInfo::Type action_type, | 65 extensions::ActionInfo::Type action_type, |
65 const extensions::ActionInfo& manifest_data) | 66 const extensions::ActionInfo& manifest_data) |
66 : extension_id_(extension_id), action_type_(action_type) { | 67 : extension_id_(extension_id), action_type_(action_type) { |
67 // Page/script actions are hidden/disabled by default, and browser actions are | 68 // Page/script actions are hidden/disabled by default, and browser actions are |
68 // visible/enabled by default. | 69 // visible/enabled by default. |
69 SetIsVisible(kDefaultTabId, | 70 SetIsVisible(kDefaultTabId, |
70 action_type == extensions::ActionInfo::TYPE_BROWSER); | 71 action_type == extensions::ActionInfo::TYPE_BROWSER); |
71 SetTitle(kDefaultTabId, manifest_data.default_title); | 72 SetTitle(kDefaultTabId, manifest_data.default_title); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // If there is a default icon, the icon width will be set depending on our | 246 // If there is a default icon, the icon width will be set depending on our |
246 // action type. | 247 // action type. |
247 if (default_icon_) | 248 if (default_icon_) |
248 return GetIconSizeForType(action_type()); | 249 return GetIconSizeForType(action_type()); |
249 | 250 |
250 // If no icon has been set and there is no default icon, we need favicon | 251 // If no icon has been set and there is no default icon, we need favicon |
251 // width. | 252 // width. |
252 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 253 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
253 IDR_EXTENSIONS_FAVICON).ToImageSkia()->width(); | 254 IDR_EXTENSIONS_FAVICON).ToImageSkia()->width(); |
254 } | 255 } |
OLD | NEW |