OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <list> | 10 #include <list> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 virtual const std::string GetResult() = 0; | 74 virtual const std::string GetResult() = 0; |
75 | 75 |
76 // Retrieves any error string from the function. | 76 // Retrieves any error string from the function. |
77 virtual const std::string GetError() = 0; | 77 virtual const std::string GetError() = 0; |
78 | 78 |
79 // Returns a quota limit heuristic suitable for this function. | 79 // Returns a quota limit heuristic suitable for this function. |
80 // No quota limiting by default. | 80 // No quota limiting by default. |
81 virtual void GetQuotaLimitHeuristics( | 81 virtual void GetQuotaLimitHeuristics( |
82 std::list<QuotaLimitHeuristic*>* heuristics) const {} | 82 std::list<QuotaLimitHeuristic*>* heuristics) const {} |
83 | 83 |
84 void set_dispatcher_peer(ExtensionFunctionDispatcher::Peer* peer) { | 84 void set_dispatcher( |
85 peer_ = peer; | 85 const base::WeakPtr<ExtensionFunctionDispatcher>& dispatcher) { |
| 86 dispatcher_ = dispatcher; |
86 } | 87 } |
87 ExtensionFunctionDispatcher* dispatcher() const { | 88 ExtensionFunctionDispatcher* dispatcher() const { |
88 return peer_->dispatcher_; | 89 return dispatcher_.get(); |
89 } | 90 } |
90 | 91 |
91 void set_request_id(int request_id) { request_id_ = request_id; } | 92 void set_request_id(int request_id) { request_id_ = request_id; } |
92 int request_id() { return request_id_; } | 93 int request_id() { return request_id_; } |
93 | 94 |
94 void set_source_url(const GURL& source_url) { source_url_ = source_url; } | 95 void set_source_url(const GURL& source_url) { source_url_ = source_url; } |
95 const GURL& source_url() { return source_url_; } | 96 const GURL& source_url() { return source_url_; } |
96 | 97 |
97 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } | 98 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } |
98 bool has_callback() { return has_callback_; } | 99 bool has_callback() { return has_callback_; } |
(...skipping 29 matching lines...) Expand all Loading... |
128 // foremost one. | 129 // foremost one. |
129 // | 130 // |
130 // Incognito browsers are not considered unless the calling extension has | 131 // Incognito browsers are not considered unless the calling extension has |
131 // incognito access enabled. | 132 // incognito access enabled. |
132 // | 133 // |
133 // This method can return NULL if there is no matching browser, which can | 134 // This method can return NULL if there is no matching browser, which can |
134 // happen if only incognito windows are open, or early in startup or shutdown | 135 // happen if only incognito windows are open, or early in startup or shutdown |
135 // shutdown when there are no active windows. | 136 // shutdown when there are no active windows. |
136 Browser* GetCurrentBrowser(); | 137 Browser* GetCurrentBrowser(); |
137 | 138 |
138 // The peer to the dispatcher that will service this extension function call. | 139 // The dispatcher that will service this extension function call. |
139 scoped_refptr<ExtensionFunctionDispatcher::Peer> peer_; | 140 base::WeakPtr<ExtensionFunctionDispatcher> dispatcher_; |
140 | 141 |
141 // The RenderViewHost we will send responses too. | 142 // The RenderViewHost we will send responses too. |
142 RenderViewHost* render_view_host_; | 143 RenderViewHost* render_view_host_; |
143 | 144 |
144 // Id of this request, used to map the response back to the caller. | 145 // Id of this request, used to map the response back to the caller. |
145 int request_id_; | 146 int request_id_; |
146 | 147 |
147 // The Profile of this function's extension. | 148 // The Profile of this function's extension. |
148 Profile* profile_; | 149 Profile* profile_; |
149 | 150 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 virtual void Run(); | 264 virtual void Run(); |
264 | 265 |
265 protected: | 266 protected: |
266 virtual ~SyncExtensionFunction(); | 267 virtual ~SyncExtensionFunction(); |
267 | 268 |
268 private: | 269 private: |
269 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); | 270 DISALLOW_COPY_AND_ASSIGN(SyncExtensionFunction); |
270 }; | 271 }; |
271 | 272 |
272 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 273 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |