| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 bool ExtensionAction::HasIsVisible(int tab_id) const { | 285 bool ExtensionAction::HasIsVisible(int tab_id) const { |
| 286 return HasValue(is_visible_, tab_id); | 286 return HasValue(is_visible_, tab_id); |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool ExtensionAction::HasIcon(int tab_id) const { | 289 bool ExtensionAction::HasIcon(int tab_id) const { |
| 290 return HasValue(icon_, tab_id); | 290 return HasValue(icon_, tab_id); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void ExtensionAction::SetDefaultIconForTest( | 293 void ExtensionAction::SetDefaultIconForTest( |
| 294 scoped_ptr<ExtensionIconSet> default_icon) { | 294 std::unique_ptr<ExtensionIconSet> default_icon) { |
| 295 default_icon_ = std::move(default_icon); | 295 default_icon_ = std::move(default_icon); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void ExtensionAction::Populate(const extensions::Extension& extension, | 298 void ExtensionAction::Populate(const extensions::Extension& extension, |
| 299 const extensions::ActionInfo& manifest_data) { | 299 const extensions::ActionInfo& manifest_data) { |
| 300 // If the manifest doesn't specify a title, set it to |extension|'s name. | 300 // If the manifest doesn't specify a title, set it to |extension|'s name. |
| 301 const std::string& title = | 301 const std::string& title = |
| 302 !manifest_data.default_title.empty() ? manifest_data.default_title : | 302 !manifest_data.default_title.empty() ? manifest_data.default_title : |
| 303 extension.name(); | 303 extension.name(); |
| 304 SetTitle(kDefaultTabId, title); | 304 SetTitle(kDefaultTabId, title); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 326 // If there is a default icon, the icon width will be set depending on our | 326 // If there is a default icon, the icon width will be set depending on our |
| 327 // action type. | 327 // action type. |
| 328 if (default_icon_) | 328 if (default_icon_) |
| 329 return ActionIconSize(); | 329 return ActionIconSize(); |
| 330 | 330 |
| 331 // If no icon has been set and there is no default icon, we need favicon | 331 // If no icon has been set and there is no default icon, we need favicon |
| 332 // width. | 332 // width. |
| 333 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 333 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 334 IDR_EXTENSIONS_FAVICON).Width(); | 334 IDR_EXTENSIONS_FAVICON).Width(); |
| 335 } | 335 } |
| OLD | NEW |