| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 void ExtensionAction::Populate(const extensions::Extension& extension, | 336 void ExtensionAction::Populate(const extensions::Extension& extension, |
| 337 const extensions::ActionInfo& manifest_data) { | 337 const extensions::ActionInfo& manifest_data) { |
| 338 // If the manifest doesn't specify a title, set it to |extension|'s name. | 338 // If the manifest doesn't specify a title, set it to |extension|'s name. |
| 339 const std::string& title = | 339 const std::string& title = |
| 340 !manifest_data.default_title.empty() ? manifest_data.default_title : | 340 !manifest_data.default_title.empty() ? manifest_data.default_title : |
| 341 extension.name(); | 341 extension.name(); |
| 342 SetTitle(kDefaultTabId, title); | 342 SetTitle(kDefaultTabId, title); |
| 343 SetPopupUrl(kDefaultTabId, manifest_data.default_popup_url); | 343 SetPopupUrl(kDefaultTabId, manifest_data.default_popup_url); |
| 344 set_id(manifest_data.id); | 344 set_id(manifest_data.id); |
| 345 | 345 |
| 346 // Initialize open_in_sidebar |
| 347 set_open_in_sidebar(manifest_data.open_in_sidebar); |
| 348 |
| 346 // Initialize the specified icon set. | 349 // Initialize the specified icon set. |
| 347 if (!manifest_data.default_icon.empty()) | 350 if (!manifest_data.default_icon.empty()) |
| 348 default_icon_.reset(new ExtensionIconSet(manifest_data.default_icon)); | 351 default_icon_.reset(new ExtensionIconSet(manifest_data.default_icon)); |
| 349 | 352 |
| 350 const ExtensionIconSet& extension_icons = | 353 const ExtensionIconSet& extension_icons = |
| 351 extensions::IconsInfo::GetIcons(&extension); | 354 extensions::IconsInfo::GetIcons(&extension); |
| 352 // Look for any other icons. | 355 // Look for any other icons. |
| 353 std::string largest_icon = extension_icons.Get( | 356 std::string largest_icon = extension_icons.Get( |
| 354 extension_misc::EXTENSION_ICON_GIGANTOR, ExtensionIconSet::MATCH_SMALLER); | 357 extension_misc::EXTENSION_ICON_GIGANTOR, ExtensionIconSet::MATCH_SMALLER); |
| 355 | 358 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 382 // If there is a default icon, the icon width will be set depending on our | 385 // If there is a default icon, the icon width will be set depending on our |
| 383 // action type. | 386 // action type. |
| 384 if (default_icon_) | 387 if (default_icon_) |
| 385 return GetIconSizeForType(action_type()); | 388 return GetIconSizeForType(action_type()); |
| 386 | 389 |
| 387 // If no icon has been set and there is no default icon, we need favicon | 390 // If no icon has been set and there is no default icon, we need favicon |
| 388 // width. | 391 // width. |
| 389 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 392 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 390 IDR_EXTENSIONS_FAVICON).Width(); | 393 IDR_EXTENSIONS_FAVICON).Width(); |
| 391 } | 394 } |
| OLD | NEW |