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

Side by Side Diff: extensions/browser/extension_function.h

Issue 145463002: Extensions: Send the tab id to platform apps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix null pointer deref Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/extensions/request_sender.cc ('k') | extensions/browser/extension_function.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 void set_histogram_value( 185 void set_histogram_value(
186 extensions::functions::HistogramValue histogram_value) { 186 extensions::functions::HistogramValue histogram_value) {
187 histogram_value_ = histogram_value; } 187 histogram_value_ = histogram_value; }
188 extensions::functions::HistogramValue histogram_value() const { 188 extensions::functions::HistogramValue histogram_value() const {
189 return histogram_value_; } 189 return histogram_value_; }
190 190
191 void set_response_callback(const ResponseCallback& callback) { 191 void set_response_callback(const ResponseCallback& callback) {
192 response_callback_ = callback; 192 response_callback_ = callback;
193 } 193 }
194 194
195 void set_source_tab_id(int source_tab_id) { source_tab_id_ = source_tab_id; }
196 int source_tab_id() const { return source_tab_id_; }
197
195 protected: 198 protected:
196 friend struct ExtensionFunctionDeleteTraits; 199 friend struct ExtensionFunctionDeleteTraits;
197 200
198 virtual ~ExtensionFunction(); 201 virtual ~ExtensionFunction();
199 202
200 // Helper method for ExtensionFunctionDeleteTraits. Deletes this object. 203 // Helper method for ExtensionFunctionDeleteTraits. Deletes this object.
201 virtual void Destruct() const = 0; 204 virtual void Destruct() const = 0;
202 205
203 // Derived classes should implement this method to do their work and return 206 // Derived classes should implement this method to do their work and return
204 // success/failure. 207 // success/failure.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // returning. Usually we want to kill the message sending process. 260 // returning. Usually we want to kill the message sending process.
258 bool bad_message_; 261 bool bad_message_;
259 262
260 // The sample value to record with the histogram API when the function 263 // The sample value to record with the histogram API when the function
261 // is invoked. 264 // is invoked.
262 extensions::functions::HistogramValue histogram_value_; 265 extensions::functions::HistogramValue histogram_value_;
263 266
264 // The callback to run once the function has done execution. 267 // The callback to run once the function has done execution.
265 ResponseCallback response_callback_; 268 ResponseCallback response_callback_;
266 269
270 // The ID of the tab triggered this function call, or -1 if there is no tab.
271 int source_tab_id_;
272
273 private:
267 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction); 274 DISALLOW_COPY_AND_ASSIGN(ExtensionFunction);
268 }; 275 };
269 276
270 // Extension functions that run on the UI thread. Most functions fall into 277 // Extension functions that run on the UI thread. Most functions fall into
271 // this category. 278 // this category.
272 class UIThreadExtensionFunction : public ExtensionFunction { 279 class UIThreadExtensionFunction : public ExtensionFunction {
273 public: 280 public:
274 // TODO(yzshen): We should be able to remove this interface now that we 281 // TODO(yzshen): We should be able to remove this interface now that we
275 // support overriding the response callback. 282 // support overriding the response callback.
276 // A delegate for use in testing, to intercept the call to SendResponse. 283 // A delegate for use in testing, to intercept the call to SendResponse.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 public: 443 public:
437 SyncIOThreadExtensionFunction(); 444 SyncIOThreadExtensionFunction();
438 445
439 virtual void Run() OVERRIDE; 446 virtual void Run() OVERRIDE;
440 447
441 protected: 448 protected:
442 virtual ~SyncIOThreadExtensionFunction(); 449 virtual ~SyncIOThreadExtensionFunction();
443 }; 450 };
444 451
445 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 452 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/request_sender.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698