| OLD | NEW |
| 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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 dispatcher_ = dispatcher; | 436 dispatcher_ = dispatcher; |
| 437 } | 437 } |
| 438 extensions::ExtensionFunctionDispatcher* dispatcher() const { | 438 extensions::ExtensionFunctionDispatcher* dispatcher() const { |
| 439 return dispatcher_.get(); | 439 return dispatcher_.get(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 // Gets the "current" web contents if any. If there is no associated web | 442 // Gets the "current" web contents if any. If there is no associated web |
| 443 // contents then defaults to the foremost one. | 443 // contents then defaults to the foremost one. |
| 444 virtual content::WebContents* GetAssociatedWebContents(); | 444 virtual content::WebContents* GetAssociatedWebContents(); |
| 445 | 445 |
| 446 // Gets the visible web contents if any. In many cases this will be the same |
| 447 // WebContents as |GetAssociatedWebContents|, however not always, in |
| 448 // particular when the function caller is a background page. |
| 449 virtual content::WebContents* GetVisibleWebContents(); |
| 450 |
| 446 protected: | 451 protected: |
| 447 // Emits a message to the extension's devtools console. | 452 // Emits a message to the extension's devtools console. |
| 448 void WriteToConsole(content::ConsoleMessageLevel level, | 453 void WriteToConsole(content::ConsoleMessageLevel level, |
| 449 const std::string& message); | 454 const std::string& message); |
| 450 | 455 |
| 451 friend struct content::BrowserThread::DeleteOnThread< | 456 friend struct content::BrowserThread::DeleteOnThread< |
| 452 content::BrowserThread::UI>; | 457 content::BrowserThread::UI>; |
| 453 friend class base::DeleteHelper<UIThreadExtensionFunction>; | 458 friend class base::DeleteHelper<UIThreadExtensionFunction>; |
| 454 | 459 |
| 455 virtual ~UIThreadExtensionFunction(); | 460 virtual ~UIThreadExtensionFunction(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 virtual bool RunSync() = 0; | 610 virtual bool RunSync() = 0; |
| 606 | 611 |
| 607 // ValidationFailure override to match RunSync(). | 612 // ValidationFailure override to match RunSync(). |
| 608 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); | 613 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); |
| 609 | 614 |
| 610 private: | 615 private: |
| 611 virtual ResponseAction Run() OVERRIDE; | 616 virtual ResponseAction Run() OVERRIDE; |
| 612 }; | 617 }; |
| 613 | 618 |
| 614 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 619 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| OLD | NEW |