Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 // we can gracefully handle cases like WebContents, where the RVH, extension, | 48 // we can gracefully handle cases like WebContents, where the RVH, extension, |
| 49 // and URL can all change over the lifetime of the tab. Instead, these items | 49 // and URL can all change over the lifetime of the tab. Instead, these items |
| 50 // are all passed into each request. | 50 // are all passed into each request. |
| 51 class ExtensionFunctionDispatcher | 51 class ExtensionFunctionDispatcher |
| 52 : public base::SupportsWeakPtr<ExtensionFunctionDispatcher> { | 52 : public base::SupportsWeakPtr<ExtensionFunctionDispatcher> { |
| 53 public: | 53 public: |
| 54 class Delegate { | 54 class Delegate { |
| 55 public: | 55 public: |
| 56 // Returns the browser that this delegate is associated with, if any. | 56 // Returns the browser that this delegate is associated with, if any. |
| 57 // Returns NULL otherwise. | 57 // Returns NULL otherwise. |
| 58 virtual Browser* GetBrowser() = 0; | 58 virtual Browser* GetBrowser(); |
|
jeremya
2012/05/07 00:54:38
This is going to conflict with stevenjb's patch: h
benwells
2012/05/07 08:46:15
;_;
| |
| 59 | 59 |
| 60 // Asks the delegate for any relevant WebContents associated with this | 60 // Asks the delegate for any relevant WebContents associated with this |
| 61 // context. For example, the WebbContents in which an infobar or | 61 // context. For example, the WebbContents in which an infobar or |
| 62 // chrome-extension://<id> URL are being shown. Callers must check for a | 62 // chrome-extension://<id> URL are being shown. Callers must check for a |
| 63 // NULL return value (as in the case of a background page). | 63 // NULL return value (as in the case of a background page). |
| 64 virtual content::WebContents* GetAssociatedWebContents() const = 0; | 64 virtual content::WebContents* GetAssociatedWebContents() const; |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 virtual ~Delegate() {} | 67 virtual ~Delegate() {} |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Gets a list of all known extension function names. | 70 // Gets a list of all known extension function names. |
| 71 static void GetAllFunctionNames(std::vector<std::string>* names); | 71 static void GetAllFunctionNames(std::vector<std::string>* names); |
| 72 | 72 |
| 73 // Override a previously registered function. Returns true if successful, | 73 // Override a previously registered function. Returns true if successful, |
| 74 // false if no such function was registered. | 74 // false if no such function was registered. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 static void SendAccessDenied(IPC::Message::Sender* ipc_sender, | 137 static void SendAccessDenied(IPC::Message::Sender* ipc_sender, |
| 138 int routing_id, | 138 int routing_id, |
| 139 int request_id); | 139 int request_id); |
| 140 | 140 |
| 141 Profile* profile_; | 141 Profile* profile_; |
| 142 | 142 |
| 143 Delegate* delegate_; | 143 Delegate* delegate_; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 146 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
| OLD | NEW |