Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chrome/renderer/extensions/request_sender.h

Issue 10821133: Move c/r/extensions/* into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_RENDERER_EXTENSIONS_EXTENSION_REQUEST_SENDER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_
6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_REQUEST_SENDER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <map> 9 #include <map>
10 10
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "v8/include/v8.h" 12 #include "v8/include/v8.h"
13 13
14 class ChromeV8ContextSet;
15 class ExtensionDispatcher;
16
17 namespace base { 14 namespace base {
18 class ListValue; 15 class ListValue;
19 } 16 }
20 17
18 namespace extensions {
19 class ChromeV8ContextSet;
20 class Dispatcher;
21
21 struct PendingRequest; 22 struct PendingRequest;
22 23
23 // Responsible for sending requests for named extension API functions to the 24 // Responsible for sending requests for named extension API functions to the
24 // extension host and routing the responses back to the caller. 25 // extension host and routing the responses back to the caller.
25 class ExtensionRequestSender { 26 class RequestSender {
26 public: 27 public:
27 explicit ExtensionRequestSender(ExtensionDispatcher* extension_dispatcher, 28 explicit RequestSender(Dispatcher* dispatcher,
28 ChromeV8ContextSet* context_set); 29 ChromeV8ContextSet* context_set);
29 ~ExtensionRequestSender(); 30 ~RequestSender();
30 31
31 // Makes a call to the API function |name| that is to be handled by the 32 // Makes a call to the API function |name| that is to be handled by the
32 // extension host. The response to this request will be received in 33 // extension host. The response to this request will be received in
33 // HandleResponse(). 34 // HandleResponse().
34 // TODO(koz): Remove |request_id| and generate that internally. 35 // TODO(koz): Remove |request_id| and generate that internally.
35 void StartRequest(const std::string& name, 36 void StartRequest(const std::string& name,
36 int request_id, 37 int request_id,
37 bool has_callback, 38 bool has_callback,
38 bool for_io_thread, 39 bool for_io_thread,
39 base::ListValue* value_args); 40 base::ListValue* value_args);
40 41
41 // Handles responses from the extension host to calls made by StartRequest(). 42 // Handles responses from the extension host to calls made by StartRequest().
42 void HandleResponse(int request_id, 43 void HandleResponse(int request_id,
43 bool success, 44 bool success,
44 const base::ListValue& response, 45 const base::ListValue& response,
45 const std::string& error); 46 const std::string& error);
46 47
47 48
48 private: 49 private:
49 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap; 50 typedef std::map<int, linked_ptr<PendingRequest> > PendingRequestMap;
50 51
51 void InsertRequest(int request_id, PendingRequest* pending_request); 52 void InsertRequest(int request_id, PendingRequest* pending_request);
52 linked_ptr<PendingRequest> RemoveRequest(int request_id); 53 linked_ptr<PendingRequest> RemoveRequest(int request_id);
53 54
54 ExtensionDispatcher* extension_dispatcher_; 55 Dispatcher* dispatcher_;
55 PendingRequestMap pending_requests_; 56 PendingRequestMap pending_requests_;
56 ChromeV8ContextSet* context_set_; 57 ChromeV8ContextSet* context_set_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(ExtensionRequestSender); 59 DISALLOW_COPY_AND_ASSIGN(RequestSender);
59 }; 60 };
60 61
61 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_REQUEST_SENDER_H_ 62 } // namespace extensions
63
64 #endif // CHROME_RENDERER_EXTENSIONS_REQUEST_SENDER_H_
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/page_actions_custom_bindings.cc ('k') | chrome/renderer/extensions/request_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698