Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: chrome/browser/extensions/execute_code_in_tab_function.cc

Issue 377036: Fix memory leak in AsyncExtensionFunction. (Closed)
Patch Set: feedback Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_bookmarks_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/execute_code_in_tab_function.h" 5 #include "chrome/browser/extensions/execute_code_in_tab_function.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/extensions/extension_tabs_module.h" 9 #include "chrome/browser/extensions/extension_tabs_module.h"
10 #include "chrome/browser/extensions/extension_tabs_module_constants.h" 10 #include "chrome/browser/extensions/extension_tabs_module_constants.h"
11 #include "chrome/browser/extensions/file_reader.h" 11 #include "chrome/browser/extensions/file_reader.h"
12 #include "chrome/browser/tab_contents/tab_contents.h" 12 #include "chrome/browser/tab_contents/tab_contents.h"
13 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
14 #include "chrome/common/extensions/extension_error_utils.h" 14 #include "chrome/common/extensions/extension_error_utils.h"
15 15
16 namespace keys = extension_tabs_module_constants; 16 namespace keys = extension_tabs_module_constants;
17 17
18 const wchar_t* kCodeKey = L"code"; 18 const wchar_t* kCodeKey = L"code";
19 const wchar_t* kFileKey = L"file"; 19 const wchar_t* kFileKey = L"file";
20 20
21 bool ExecuteCodeInTabFunction::RunImpl() { 21 bool ExecuteCodeInTabFunction::RunImpl() {
22 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST)); 22 EXTENSION_FUNCTION_VALIDATE(args_->IsType(Value::TYPE_LIST));
23 const ListValue* args = static_cast<const ListValue*>(args_); 23 const ListValue* args = args_as_list();
24 24
25 DictionaryValue* script_info; 25 DictionaryValue* script_info;
26 EXTENSION_FUNCTION_VALIDATE(args->GetDictionary(1, &script_info)); 26 EXTENSION_FUNCTION_VALIDATE(args->GetDictionary(1, &script_info));
27 size_t number_of_value = script_info->GetSize(); 27 size_t number_of_value = script_info->GetSize();
28 if (number_of_value == 0) { 28 if (number_of_value == 0) {
29 error_ = keys::kNoCodeOrFileToExecuteError; 29 error_ = keys::kNoCodeOrFileToExecuteError;
30 return false; 30 return false;
31 } else if (number_of_value > 1) { 31 } else if (number_of_value > 1) {
32 error_ = keys::kMoreThanOneValuesError; 32 error_ = keys::kMoreThanOneValuesError;
33 return false; 33 return false;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void ExecuteCodeInTabFunction::Observe(NotificationType type, 139 void ExecuteCodeInTabFunction::Observe(NotificationType type,
140 const NotificationSource& source, 140 const NotificationSource& source,
141 const NotificationDetails& details) { 141 const NotificationDetails& details) {
142 std::pair<int, bool>* result_details = 142 std::pair<int, bool>* result_details =
143 Details<std::pair<int, bool> >(details).ptr(); 143 Details<std::pair<int, bool> >(details).ptr();
144 if (result_details->first == request_id()) { 144 if (result_details->first == request_id()) {
145 SendResponse(result_details->second); 145 SendResponse(result_details->second);
146 Release(); // balanced in Execute() 146 Release(); // balanced in Execute()
147 } 147 }
148 } 148 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_bookmarks_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698