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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 799 |
800 return true; | 800 return true; |
801 } | 801 } |
802 | 802 |
803 scoped_ptr<ExtensionAction> Extension::LoadExtensionActionHelper( | 803 scoped_ptr<ExtensionAction> Extension::LoadExtensionActionHelper( |
804 const DictionaryValue* extension_action, | 804 const DictionaryValue* extension_action, |
805 ExtensionAction::Type action_type, | 805 ExtensionAction::Type action_type, |
806 string16* error) { | 806 string16* error) { |
807 scoped_ptr<ExtensionAction> result(new ExtensionAction(id(), action_type)); | 807 scoped_ptr<ExtensionAction> result(new ExtensionAction(id(), action_type)); |
808 | 808 |
809 // Page actions are hidden/disabled by default, and browser actions are | 809 // Page/script actions are hidden/disabled by default, and browser actions are |
810 // visible/enabled by default. | 810 // visible/enabled by default. |
811 result->SetIsVisible(ExtensionAction::kDefaultTabId, | 811 result->SetIsVisible(ExtensionAction::kDefaultTabId, |
812 action_type != ExtensionAction::TYPE_PAGE); | 812 action_type == ExtensionAction::TYPE_BROWSER); |
813 | 813 |
814 if (manifest_version_ == 1) { | 814 if (manifest_version_ == 1) { |
815 const ListValue* icons = NULL; | 815 const ListValue* icons = NULL; |
816 if (extension_action->HasKey(keys::kPageActionIcons) && | 816 if (extension_action->HasKey(keys::kPageActionIcons) && |
817 extension_action->GetList(keys::kPageActionIcons, &icons)) { | 817 extension_action->GetList(keys::kPageActionIcons, &icons)) { |
818 for (ListValue::const_iterator iter = icons->begin(); | 818 for (ListValue::const_iterator iter = icons->begin(); |
819 iter != icons->end(); ++iter) { | 819 iter != icons->end(); ++iter) { |
820 std::string path; | 820 std::string path; |
821 if (!(*iter)->GetAsString(&path) || path.empty()) { | 821 if (!(*iter)->GetAsString(&path) || path.empty()) { |
822 *error = ASCIIToUTF16(errors::kInvalidPageActionIconPath); | 822 *error = ASCIIToUTF16(errors::kInvalidPageActionIconPath); |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 ExtensionIconSet::MATCH_EXACTLY); | 2370 ExtensionIconSet::MATCH_EXACTLY); |
2371 if (!icon16_path.empty()) { | 2371 if (!icon16_path.empty()) { |
2372 script_badge_->set_default_icon_path(icon16_path); | 2372 script_badge_->set_default_icon_path(icon16_path); |
2373 } else { | 2373 } else { |
2374 script_badge_->SetIcon( | 2374 script_badge_->SetIcon( |
2375 ExtensionAction::kDefaultTabId, | 2375 ExtensionAction::kDefaultTabId, |
2376 *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 2376 *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
2377 IDR_EXTENSIONS_FAVICON).ToSkBitmap()); | 2377 IDR_EXTENSIONS_FAVICON).ToSkBitmap()); |
2378 } | 2378 } |
2379 | 2379 |
2380 script_badge_->SetIsVisible(ExtensionAction::kDefaultTabId, true); | |
2381 | |
2382 return true; | 2380 return true; |
2383 } | 2381 } |
2384 | 2382 |
2385 bool Extension::LoadFileBrowserHandlers(string16* error) { | 2383 bool Extension::LoadFileBrowserHandlers(string16* error) { |
2386 if (!manifest_->HasKey(keys::kFileBrowserHandlers)) | 2384 if (!manifest_->HasKey(keys::kFileBrowserHandlers)) |
2387 return true; | 2385 return true; |
2388 ListValue* file_browser_handlers_value = NULL; | 2386 ListValue* file_browser_handlers_value = NULL; |
2389 if (!manifest_->GetList(keys::kFileBrowserHandlers, | 2387 if (!manifest_->GetList(keys::kFileBrowserHandlers, |
2390 &file_browser_handlers_value)) { | 2388 &file_browser_handlers_value)) { |
2391 *error = ASCIIToUTF16(errors::kInvalidFileBrowserHandler); | 2389 *error = ASCIIToUTF16(errors::kInvalidFileBrowserHandler); |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3884 | 3882 |
3885 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3883 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3886 const Extension* extension, | 3884 const Extension* extension, |
3887 const PermissionSet* permissions, | 3885 const PermissionSet* permissions, |
3888 Reason reason) | 3886 Reason reason) |
3889 : reason(reason), | 3887 : reason(reason), |
3890 extension(extension), | 3888 extension(extension), |
3891 permissions(permissions) {} | 3889 permissions(permissions) {} |
3892 | 3890 |
3893 } // namespace extensions | 3891 } // namespace extensions |
OLD | NEW |