| 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/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 302 |
| 303 void ExtensionAction::Populate(const extensions::Extension& extension, | 303 void ExtensionAction::Populate(const extensions::Extension& extension, |
| 304 const extensions::ActionInfo& manifest_data) { | 304 const extensions::ActionInfo& manifest_data) { |
| 305 // If the manifest doesn't specify a title, set it to |extension|'s name. | 305 // If the manifest doesn't specify a title, set it to |extension|'s name. |
| 306 const std::string& title = | 306 const std::string& title = |
| 307 !manifest_data.default_title.empty() ? manifest_data.default_title : | 307 !manifest_data.default_title.empty() ? manifest_data.default_title : |
| 308 extension.name(); | 308 extension.name(); |
| 309 SetTitle(kDefaultTabId, title); | 309 SetTitle(kDefaultTabId, title); |
| 310 SetPopupUrl(kDefaultTabId, manifest_data.default_popup_url); | 310 SetPopupUrl(kDefaultTabId, manifest_data.default_popup_url); |
| 311 set_id(manifest_data.id); | 311 set_id(manifest_data.id); |
| 312 set_open_in_sidebar(manifest_data.open_in_sidebar); |
| 312 | 313 |
| 313 // Initialize the specified icon set. | 314 // Initialize the specified icon set. |
| 314 if (!manifest_data.default_icon.empty()) | 315 if (!manifest_data.default_icon.empty()) |
| 315 default_icon_.reset(new ExtensionIconSet(manifest_data.default_icon)); | 316 default_icon_.reset(new ExtensionIconSet(manifest_data.default_icon)); |
| 316 | 317 |
| 317 const ExtensionIconSet& extension_icons = | 318 const ExtensionIconSet& extension_icons = |
| 318 extensions::IconsInfo::GetIcons(&extension); | 319 extensions::IconsInfo::GetIcons(&extension); |
| 319 // Look for any other icons. | 320 // Look for any other icons. |
| 320 std::string largest_icon = extension_icons.Get( | 321 std::string largest_icon = extension_icons.Get( |
| 321 extension_misc::EXTENSION_ICON_GIGANTOR, ExtensionIconSet::MATCH_SMALLER); | 322 extension_misc::EXTENSION_ICON_GIGANTOR, ExtensionIconSet::MATCH_SMALLER); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 349 // If there is a default icon, the icon width will be set depending on our | 350 // If there is a default icon, the icon width will be set depending on our |
| 350 // action type. | 351 // action type. |
| 351 if (default_icon_) | 352 if (default_icon_) |
| 352 return GetIconSizeForType(action_type()); | 353 return GetIconSizeForType(action_type()); |
| 353 | 354 |
| 354 // If no icon has been set and there is no default icon, we need favicon | 355 // If no icon has been set and there is no default icon, we need favicon |
| 355 // width. | 356 // width. |
| 356 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 357 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 357 IDR_EXTENSIONS_FAVICON).Width(); | 358 IDR_EXTENSIONS_FAVICON).Width(); |
| 358 } | 359 } |
| OLD | NEW |