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 ExtensionWindowController associated with this delegate, | 56 // Returns the ExtensionWindowController associated with this delegate, |
57 // or NULL if no window is associated with the delegate. | 57 // or NULL if no window is associated with the delegate. |
58 virtual ExtensionWindowController* GetExtensionWindowController() const = 0; | 58 virtual ExtensionWindowController* GetExtensionWindowController() const; |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 static void SendAccessDenied(IPC::Message::Sender* ipc_sender, | 128 static void SendAccessDenied(IPC::Message::Sender* ipc_sender, |
129 int routing_id, | 129 int routing_id, |
130 int request_id); | 130 int request_id); |
131 | 131 |
132 Profile* profile_; | 132 Profile* profile_; |
133 | 133 |
134 Delegate* delegate_; | 134 Delegate* delegate_; |
135 }; | 135 }; |
136 | 136 |
137 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ | 137 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DISPATCHER_H_ |
OLD | NEW |