Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/sequenced_task_runner_helpers.h" | 17 #include "base/sequenced_task_runner_helpers.h" |
| 18 #include "base/strings/string_util.h" | |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/common/console_message_level.h" | 20 #include "content/public/common/console_message_level.h" |
| 20 #include "extensions/browser/extension_function_histogram_value.h" | 21 #include "extensions/browser/extension_function_histogram_value.h" |
| 21 #include "extensions/browser/info_map.h" | 22 #include "extensions/browser/info_map.h" |
| 22 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 23 #include "extensions/common/features/feature.h" | 24 #include "extensions/common/features/feature.h" |
| 24 #include "ipc/ipc_message.h" | 25 #include "ipc/ipc_message.h" |
| 25 | 26 |
| 26 class ExtensionFunction; | 27 class ExtensionFunction; |
| 27 class UIThreadExtensionFunction; | 28 class UIThreadExtensionFunction; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 const std::string& name() const { return name_; } | 212 const std::string& name() const { return name_; } |
| 212 | 213 |
| 213 void set_profile_id(void* profile_id) { profile_id_ = profile_id; } | 214 void set_profile_id(void* profile_id) { profile_id_ = profile_id; } |
| 214 void* profile_id() const { return profile_id_; } | 215 void* profile_id() const { return profile_id_; } |
| 215 | 216 |
| 216 void set_extension( | 217 void set_extension( |
| 217 const scoped_refptr<const extensions::Extension>& extension) { | 218 const scoped_refptr<const extensions::Extension>& extension) { |
| 218 extension_ = extension; | 219 extension_ = extension; |
| 219 } | 220 } |
| 220 const extensions::Extension* extension() const { return extension_.get(); } | 221 const extensions::Extension* extension() const { return extension_.get(); } |
| 221 const std::string& extension_id() const { return extension_->id(); } | 222 std::string extension_id() const { |
| 223 return extension_ ? extension_->id() : base::EmptyString(); | |
|
Fady Samuel
2014/10/21 21:32:57
I think Ben Kalman should review this change. It m
guohui
2014/10/22 15:35:33
Done.
| |
| 224 } | |
| 222 | 225 |
| 223 void set_request_id(int request_id) { request_id_ = request_id; } | 226 void set_request_id(int request_id) { request_id_ = request_id; } |
| 224 int request_id() { return request_id_; } | 227 int request_id() { return request_id_; } |
| 225 | 228 |
| 226 void set_source_url(const GURL& source_url) { source_url_ = source_url; } | 229 void set_source_url(const GURL& source_url) { source_url_ = source_url; } |
| 227 const GURL& source_url() { return source_url_; } | 230 const GURL& source_url() { return source_url_; } |
| 228 | 231 |
| 229 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } | 232 void set_has_callback(bool has_callback) { has_callback_ = has_callback; } |
| 230 bool has_callback() { return has_callback_; } | 233 bool has_callback() { return has_callback_; } |
| 231 | 234 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 virtual bool RunSync() = 0; | 609 virtual bool RunSync() = 0; |
| 607 | 610 |
| 608 // ValidationFailure override to match RunSync(). | 611 // ValidationFailure override to match RunSync(). |
| 609 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); | 612 static bool ValidationFailure(SyncIOThreadExtensionFunction* function); |
| 610 | 613 |
| 611 private: | 614 private: |
| 612 virtual ResponseAction Run() override; | 615 virtual ResponseAction Run() override; |
| 613 }; | 616 }; |
| 614 | 617 |
| 615 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ | 618 #endif // EXTENSIONS_BROWSER_EXTENSION_FUNCTION_H_ |
| OLD | NEW |