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_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 <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void set_request_id(int request_id) { request_id_ = request_id; } | 133 void set_request_id(int request_id) { request_id_ = request_id; } |
134 int request_id() { return request_id_; } | 134 int request_id() { return request_id_; } |
135 | 135 |
136 void set_source_url(const GURL& source_url) { source_url_ = source_url; } | 136 void set_source_url(const GURL& source_url) { source_url_ = source_url; } |
137 const GURL& source_url() { return source_url_; } | 137 const GURL& source_url() { return source_url_; } |
138 | 138 |
139 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } | 139 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } |
140 bool has_callback() { return has_callback_; } | 140 bool has_callback() { return has_callback_; } |
141 | 141 |
142 void set_include_incognito(bool include) { include_incognito_ = include; } | 142 void set_include_incognito(bool include) { include_incognito_ = include; } |
143 bool include_incognito() { return include_incognito_; } | 143 bool include_incognito() const { return include_incognito_; } |
144 | 144 |
145 void set_user_gesture(bool user_gesture) { user_gesture_ = user_gesture; } | 145 void set_user_gesture(bool user_gesture) { user_gesture_ = user_gesture; } |
146 bool user_gesture() const { return user_gesture_; } | 146 bool user_gesture() const { return user_gesture_; } |
147 | 147 |
148 protected: | 148 protected: |
149 friend struct ExtensionFunctionDeleteTraits; | 149 friend struct ExtensionFunctionDeleteTraits; |
150 | 150 |
151 virtual ~ExtensionFunction(); | 151 virtual ~ExtensionFunction(); |
152 | 152 |
153 // Helper method for ExtensionFunctionDeleteTraits. Deletes this object. | 153 // Helper method for ExtensionFunctionDeleteTraits. Deletes this object. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // This method can return NULL if there is no matching browser, which can | 280 // This method can return NULL if there is no matching browser, which can |
281 // happen if only incognito windows are open, or early in startup or shutdown | 281 // happen if only incognito windows are open, or early in startup or shutdown |
282 // shutdown when there are no active windows. | 282 // shutdown when there are no active windows. |
283 // | 283 // |
284 // TODO(stevenjb): Replace this with GetExtensionWindowController(). | 284 // TODO(stevenjb): Replace this with GetExtensionWindowController(). |
285 Browser* GetCurrentBrowser(); | 285 Browser* GetCurrentBrowser(); |
286 | 286 |
287 // Same as above but uses ExtensionWindowList instead of BrowserList. | 287 // Same as above but uses ExtensionWindowList instead of BrowserList. |
288 ExtensionWindowController* GetExtensionWindowController(); | 288 ExtensionWindowController* GetExtensionWindowController(); |
289 | 289 |
| 290 // Returns true if this function (and the profile and extension that it was |
| 291 // invoked from) can operate on the window wrapped by |window_controller|. |
| 292 bool CanOperateOnWindow( |
| 293 const ExtensionWindowController* window_controller) const; |
| 294 |
290 protected: | 295 protected: |
291 friend struct content::BrowserThread::DeleteOnThread< | 296 friend struct content::BrowserThread::DeleteOnThread< |
292 content::BrowserThread::UI>; | 297 content::BrowserThread::UI>; |
293 friend class base::DeleteHelper<UIThreadExtensionFunction>; | 298 friend class base::DeleteHelper<UIThreadExtensionFunction>; |
294 | 299 |
295 virtual ~UIThreadExtensionFunction(); | 300 virtual ~UIThreadExtensionFunction(); |
296 | 301 |
297 virtual void SendResponse(bool success) OVERRIDE; | 302 virtual void SendResponse(bool success) OVERRIDE; |
298 | 303 |
299 // The dispatcher that will service this extension function call. | 304 // The dispatcher that will service this extension function call. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 public: | 425 public: |
421 SyncIOThreadExtensionFunction(); | 426 SyncIOThreadExtensionFunction(); |
422 | 427 |
423 virtual void Run() OVERRIDE; | 428 virtual void Run() OVERRIDE; |
424 | 429 |
425 protected: | 430 protected: |
426 virtual ~SyncIOThreadExtensionFunction(); | 431 virtual ~SyncIOThreadExtensionFunction(); |
427 }; | 432 }; |
428 | 433 |
429 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 434 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |