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

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

Issue 10694106: Added support for multiple parameters to Extension API callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Indentation fixes and comment. Created 8 years, 5 months 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
OLDNEW
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_test_api.h" 5 #include "chrome/browser/extensions/extension_test_api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 AddRef(); // balanced in Reply 98 AddRef(); // balanced in Reply
99 content::NotificationService::current()->Notify( 99 content::NotificationService::current()->Notify(
100 chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE, 100 chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE,
101 content::Source<ExtensionTestSendMessageFunction>(this), 101 content::Source<ExtensionTestSendMessageFunction>(this),
102 content::Details<std::string>(&message)); 102 content::Details<std::string>(&message));
103 return true; 103 return true;
104 } 104 }
105 ExtensionTestSendMessageFunction::~ExtensionTestSendMessageFunction() {} 105 ExtensionTestSendMessageFunction::~ExtensionTestSendMessageFunction() {}
106 106
107 void ExtensionTestSendMessageFunction::Reply(const std::string& message) { 107 void ExtensionTestSendMessageFunction::Reply(const std::string& message) {
108 result_.reset(Value::CreateStringValue(message)); 108 SetSingleResult(Value::CreateStringValue(message));
109 SendResponse(true); 109 SendResponse(true);
110 Release(); // balanced in RunImpl 110 Release(); // balanced in RunImpl
111 } 111 }
112 112
113 // static 113 // static
114 void ExtensionTestGetConfigFunction::set_test_config_state( 114 void ExtensionTestGetConfigFunction::set_test_config_state(
115 DictionaryValue* value) { 115 DictionaryValue* value) {
116 TestConfigState* test_config_state = TestConfigState::GetInstance(); 116 TestConfigState* test_config_state = TestConfigState::GetInstance();
117 test_config_state->set_config_state(value); 117 test_config_state->set_config_state(value);
118 } 118 }
(...skipping 10 matching lines...) Expand all
129 ExtensionTestGetConfigFunction::~ExtensionTestGetConfigFunction() {} 129 ExtensionTestGetConfigFunction::~ExtensionTestGetConfigFunction() {}
130 130
131 bool ExtensionTestGetConfigFunction::RunImpl() { 131 bool ExtensionTestGetConfigFunction::RunImpl() {
132 TestConfigState* test_config_state = TestConfigState::GetInstance(); 132 TestConfigState* test_config_state = TestConfigState::GetInstance();
133 133
134 if (!test_config_state->config_state()) { 134 if (!test_config_state->config_state()) {
135 error_ = kNoTestConfigDataError; 135 error_ = kNoTestConfigDataError;
136 return false; 136 return false;
137 } 137 }
138 138
139 result_.reset(test_config_state->config_state()->DeepCopy()); 139 SetSingleResult(test_config_state->config_state()->DeepCopy());
140 return true; 140 return true;
141 } 141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698