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> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "chrome/browser/extensions/extension_info_map.h" | 16 #include "chrome/browser/extensions/extension_info_map.h" |
17 #include "chrome/browser/profiles/profile.h" | |
18 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
19 #include "content/browser/browser_thread.h" | 18 #include "content/browser/browser_thread.h" |
20 #include "content/common/notification_observer.h" | 19 #include "content/common/notification_observer.h" |
21 #include "content/common/notification_registrar.h" | 20 #include "content/common/notification_registrar.h" |
22 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
23 | 22 |
24 class Browser; | 23 class Browser; |
25 class ChromeRenderMessageFilter; | 24 class ChromeRenderMessageFilter; |
26 class ExtensionFunction; | 25 class ExtensionFunction; |
27 class ExtensionFunctionDispatcher; | 26 class ExtensionFunctionDispatcher; |
28 class UIThreadExtensionFunction; | 27 class UIThreadExtensionFunction; |
29 class IOThreadExtensionFunction; | 28 class IOThreadExtensionFunction; |
| 29 class Profile; |
30 class QuotaLimitHeuristic; | 30 class QuotaLimitHeuristic; |
31 class RenderViewHost; | 31 class RenderViewHost; |
32 | 32 |
33 namespace base { | 33 namespace base { |
34 class ListValue; | 34 class ListValue; |
35 class Value; | 35 class Value; |
36 } | 36 } |
37 | 37 |
38 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ | 38 #define EXTENSION_FUNCTION_VALIDATE(test) do { \ |
39 if (!(test)) { \ | 39 if (!(test)) { \ |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // be empty). | 90 // be empty). |
91 virtual const std::string GetResult(); | 91 virtual const std::string GetResult(); |
92 | 92 |
93 // Retrieves any error string from the function. | 93 // Retrieves any error string from the function. |
94 virtual const std::string GetError(); | 94 virtual const std::string GetError(); |
95 | 95 |
96 // Specifies the name of the function. | 96 // Specifies the name of the function. |
97 void set_name(const std::string& name) { name_ = name; } | 97 void set_name(const std::string& name) { name_ = name; } |
98 const std::string& name() const { return name_; } | 98 const std::string& name() const { return name_; } |
99 | 99 |
100 void set_profile_id(ProfileId profile_id) { profile_id_ = profile_id; } | 100 void set_profile(void* profile) { profile_ = profile; } |
101 ProfileId profile_id() const { return profile_id_; } | 101 void* profile() const { return profile_; } |
102 | 102 |
103 void set_extension(const Extension* extension) { extension_ = extension; } | 103 void set_extension(const Extension* extension) { extension_ = extension; } |
104 const Extension* GetExtension() const { return extension_.get(); } | 104 const Extension* GetExtension() const { return extension_.get(); } |
105 const std::string& extension_id() const { return extension_->id(); } | 105 const std::string& extension_id() const { return extension_->id(); } |
106 | 106 |
107 void set_request_id(int request_id) { request_id_ = request_id; } | 107 void set_request_id(int request_id) { request_id_ = request_id; } |
108 int request_id() { return request_id_; } | 108 int request_id() { return request_id_; } |
109 | 109 |
110 void set_source_url(const GURL& source_url) { source_url_ = source_url; } | 110 void set_source_url(const GURL& source_url) { source_url_ = source_url; } |
111 const GURL& source_url() { return source_url_; } | 111 const GURL& source_url() { return source_url_; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // the renderer instead. | 146 // the renderer instead. |
147 void HandleBadMessage(base::ProcessHandle process); | 147 void HandleBadMessage(base::ProcessHandle process); |
148 | 148 |
149 // Return true if the argument to this function at |index| was provided and | 149 // Return true if the argument to this function at |index| was provided and |
150 // is non-null. | 150 // is non-null. |
151 bool HasOptionalArgument(size_t index); | 151 bool HasOptionalArgument(size_t index); |
152 | 152 |
153 // Id of this request, used to map the response back to the caller. | 153 // Id of this request, used to map the response back to the caller. |
154 int request_id_; | 154 int request_id_; |
155 | 155 |
156 // The ID of the Profile of this function's extension. | 156 // The Profile of this function's extension. |
157 ProfileId profile_id_; | 157 void* profile_; |
158 | 158 |
159 // The extension that called this function. | 159 // The extension that called this function. |
160 scoped_refptr<const Extension> extension_; | 160 scoped_refptr<const Extension> extension_; |
161 | 161 |
162 // The name of this function. | 162 // The name of this function. |
163 std::string name_; | 163 std::string name_; |
164 | 164 |
165 // The URL of the frame which is making this request | 165 // The URL of the frame which is making this request |
166 GURL source_url_; | 166 GURL source_url_; |
167 | 167 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 public: | 352 public: |
353 SyncIOThreadExtensionFunction(); | 353 SyncIOThreadExtensionFunction(); |
354 | 354 |
355 virtual void Run() OVERRIDE; | 355 virtual void Run() OVERRIDE; |
356 | 356 |
357 protected: | 357 protected: |
358 virtual ~SyncIOThreadExtensionFunction(); | 358 virtual ~SyncIOThreadExtensionFunction(); |
359 }; | 359 }; |
360 | 360 |
361 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ | 361 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_H_ |
OLD | NEW |