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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
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 set_open_in_sidebar(manifest_data.open_in_sidebar); |
345 | 346 |
346 // Initialize the specified icon set. | 347 // Initialize the specified icon set. |
347 if (!manifest_data.default_icon.empty()) | 348 if (!manifest_data.default_icon.empty()) |
348 default_icon_.reset(new ExtensionIconSet(manifest_data.default_icon)); | 349 default_icon_.reset(new ExtensionIconSet(manifest_data.default_icon)); |
349 | 350 |
350 const ExtensionIconSet& extension_icons = | 351 const ExtensionIconSet& extension_icons = |
351 extensions::IconsInfo::GetIcons(&extension); | 352 extensions::IconsInfo::GetIcons(&extension); |
352 // Look for any other icons. | 353 // Look for any other icons. |
353 std::string largest_icon = extension_icons.Get( | 354 std::string largest_icon = extension_icons.Get( |
354 extension_misc::EXTENSION_ICON_GIGANTOR, ExtensionIconSet::MATCH_SMALLER); | 355 extension_misc::EXTENSION_ICON_GIGANTOR, ExtensionIconSet::MATCH_SMALLER); |
(...skipping 27 matching lines...) Expand all Loading... |
382 // If there is a default icon, the icon width will be set depending on our | 383 // If there is a default icon, the icon width will be set depending on our |
383 // action type. | 384 // action type. |
384 if (default_icon_) | 385 if (default_icon_) |
385 return GetIconSizeForType(action_type()); | 386 return GetIconSizeForType(action_type()); |
386 | 387 |
387 // If no icon has been set and there is no default icon, we need favicon | 388 // If no icon has been set and there is no default icon, we need favicon |
388 // width. | 389 // width. |
389 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 390 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
390 IDR_EXTENSIONS_FAVICON).Width(); | 391 IDR_EXTENSIONS_FAVICON).Width(); |
391 } | 392 } |
OLD | NEW |