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

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

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bookmarks Created 6 years, 7 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 | « extensions/browser/api/test/test_api.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // 113 //
114 // The default implementation is to check the Extension's permissions against 114 // The default implementation is to check the Extension's permissions against
115 // what this function requires to run, but some APIs may require finer 115 // what this function requires to run, but some APIs may require finer
116 // grained control, such as tabs.executeScript being allowed for active tabs. 116 // grained control, such as tabs.executeScript being allowed for active tabs.
117 // 117 //
118 // This will be run after the function has been set up but before Run(). 118 // This will be run after the function has been set up but before Run().
119 virtual bool HasPermission(); 119 virtual bool HasPermission();
120 120
121 // Execute the API. Clients should initialize the ExtensionFunction using 121 // Execute the API. Clients should initialize the ExtensionFunction using
122 // SetArgs(), set_request_id(), and the other setters before calling this 122 // SetArgs(), set_request_id(), and the other setters before calling this
123 // method. Derived classes should be ready to return GetResultList() and 123 // method.
124 // GetError() before returning from this function. 124 //
125 // Note that once Run() returns, dispatcher() can be NULL, so be sure to 125 // Note that once Run() returns, dispatcher() can be NULL, so be sure to
126 // NULL-check. 126 // NULL-check.
127 virtual void Run(); 127 void Run();
128 128
129 // Gets whether quota should be applied to this individual function 129 // Gets whether quota should be applied to this individual function
130 // invocation. This is different to GetQuotaLimitHeuristics which is only 130 // invocation. This is different to GetQuotaLimitHeuristics which is only
131 // invoked once and then cached. 131 // invoked once and then cached.
132 // 132 //
133 // Returns false by default. 133 // Returns false by default.
134 virtual bool ShouldSkipQuotaLimiting() const; 134 virtual bool ShouldSkipQuotaLimiting() const;
135 135
136 // Optionally adds one or multiple QuotaLimitHeuristic instances suitable for 136 // Optionally adds one or multiple QuotaLimitHeuristic instances suitable for
137 // this function to |heuristics|. The ownership of the new QuotaLimitHeuristic 137 // this function to |heuristics|. The ownership of the new QuotaLimitHeuristic
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // *relative to the browser's UI thread*. Note that this has nothing to do with 495 // *relative to the browser's UI thread*. Note that this has nothing to do with
496 // running synchronously relative to the extension process. From the extension 496 // running synchronously relative to the extension process. From the extension
497 // process's point of view, the function is still asynchronous. 497 // process's point of view, the function is still asynchronous.
498 // 498 //
499 // This kind of function is convenient for implementing simple APIs that just 499 // This kind of function is convenient for implementing simple APIs that just
500 // need to interact with things on the browser UI thread. 500 // need to interact with things on the browser UI thread.
501 class SyncExtensionFunction : public UIThreadExtensionFunction { 501 class SyncExtensionFunction : public UIThreadExtensionFunction {
502 public: 502 public:
503 SyncExtensionFunction(); 503 SyncExtensionFunction();
504 504
505 virtual void Run() OVERRIDE; 505 virtual bool RunImpl() OVERRIDE;
506 506
507 protected: 507 protected:
508 virtual bool RunSync() = 0;
509
508 virtual ~SyncExtensionFunction(); 510 virtual ~SyncExtensionFunction();
509 }; 511 };
510 512
511 class SyncIOThreadExtensionFunction : public IOThreadExtensionFunction { 513 class SyncIOThreadExtensionFunction : public IOThreadExtensionFunction {
512 public: 514 public:
513 SyncIOThreadExtensionFunction(); 515 SyncIOThreadExtensionFunction();
514 516
515 virtual void Run() OVERRIDE; 517 virtual bool RunImpl() OVERRIDE;
516 518
517 protected: 519 protected:
520 virtual bool RunSync() = 0;
521
518 virtual ~SyncIOThreadExtensionFunction(); 522 virtual ~SyncIOThreadExtensionFunction();
519 }; 523 };
520 524
521 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ 525 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/test/test_api.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698