| 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/api/context_menus/context_menus_api.h" | 5 #include "chrome/browser/extensions/api/context_menus/context_menus_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 if (params->create_properties.id.get()) { | 160 if (params->create_properties.id.get()) { |
| 161 id.string_uid = *params->create_properties.id; | 161 id.string_uid = *params->create_properties.id; |
| 162 } else { | 162 } else { |
| 163 if (BackgroundInfo::HasLazyBackgroundPage(GetExtension())) { | 163 if (BackgroundInfo::HasLazyBackgroundPage(GetExtension())) { |
| 164 error_ = kIdRequiredError; | 164 error_ = kIdRequiredError; |
| 165 return false; | 165 return false; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // The Generated Id is added by context_menus_custom_bindings.js. | 168 // The Generated Id is added by context_menus_custom_bindings.js. |
| 169 DictionaryValue* properties = NULL; | 169 base::DictionaryValue* properties = NULL; |
| 170 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &properties)); | 170 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &properties)); |
| 171 EXTENSION_FUNCTION_VALIDATE(properties->GetInteger(kGeneratedIdKey, | 171 EXTENSION_FUNCTION_VALIDATE(properties->GetInteger(kGeneratedIdKey, |
| 172 &id.uid)); | 172 &id.uid)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 std::string title; | 175 std::string title; |
| 176 if (params->create_properties.title.get()) | 176 if (params->create_properties.title.get()) |
| 177 title = *params->create_properties.title; | 177 title = *params->create_properties.title; |
| 178 | 178 |
| 179 MenuManager* menu_manager = profile()->GetExtensionService()->menu_manager(); | 179 MenuManager* menu_manager = profile()->GetExtensionService()->menu_manager(); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 bool ContextMenusRemoveAllFunction::RunImpl() { | 384 bool ContextMenusRemoveAllFunction::RunImpl() { |
| 385 ExtensionService* service = profile()->GetExtensionService(); | 385 ExtensionService* service = profile()->GetExtensionService(); |
| 386 MenuManager* manager = service->menu_manager(); | 386 MenuManager* manager = service->menu_manager(); |
| 387 manager->RemoveAllContextItems(GetExtension()->id()); | 387 manager->RemoveAllContextItems(GetExtension()->id()); |
| 388 manager->WriteToStorage(GetExtension()); | 388 manager->WriteToStorage(GetExtension()); |
| 389 return true; | 389 return true; |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace extensions | 392 } // namespace extensions |
| OLD | NEW |