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

Side by Side Diff: chrome/browser/extensions/api/generated_api_functions.h.tmpl

Issue 9359040: WIP IDL-IPC2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Checkpoint before going back to returning ListValue via ExtensionMsg_Response. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) $year The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file is generated. Don't edit it.
6
7 \#ifndef $guard
8 \#define $guard
9 \#pragma once
10
11 \#include <string>
12
13 \#include "chrome/browser/extensions/api/api_function.h"
14 \#include "chrome/browser/extensions/extension_factory_registry.h"
15 \#include "chrome/browser/extensions/extension_function.h"
16 \#include "chrome/browser/extensions/extension_function_dispatcher.h"
17 \#include "chrome/common/extensions/api/generated_messages.h"
18 \#include "content/browser/renderer_host/render_view_host.h"
19 \#include "content/public/browser/web_contents_observer.h"
20 \#include "ipc/ipc_message.h"
21
22 #for $family in $families
23 \#include "${family.header_path}"
24 #end for
25
26 namespace extensions {
27
28 // Keys used in API responses.
29 #for $family in $families
30 #for $function in $family.functions
31 #for $return_value in $function.return_values
32 extern const char k${$return_value.name}Key[];
33 #end for
34 #end for
35 #end for
36
37 class ExtensionAPIHost :
38 public content::WebContentsObserver {
39 public:
40 ExtensionAPIHost(
41 RenderViewHost* render_view_host,
42 ExtensionFunctionDispatcher* extension_function_dispatcher) :
43 render_view_host_(render_view_host),
44 extension_function_dispatcher_(extension_function_dispatcher) {
45 }
46
47 bool OnMessageReceived(const IPC::Message& message) {
48 bool handled = true;
49 IPC_BEGIN_MESSAGE_MAP(ExtensionAPIHost, message)
50 #for $family in $families
51 #for $function in $family.functions
52 IPC_MESSAGE_HANDLER(ExtensionAPIHostMsg_${function.class_name}, On${function .class_name})
53 #end for
54 #end for
55 IPC_MESSAGE_UNHANDLED(handled = false)
56 IPC_END_MESSAGE_MAP()
57 return handled;
58 }
59
60 private:
61 #for $family in $families
62 #for $function in $family.functions
63 void On${function.class_name}(
64 int request_id#for $argument in $function.arguments#,
65 $argument.mapped_arg_type $argument.name#end for#) {
66 render_view_host_->Send(
67 new ExtensionAPIViewMsg_${function.class_name}Response(
68 render_view_host_->routing_id(), request_id, 42));
69 }
70 #end for
71 #end for
72
73 RenderViewHost* render_view_host_;
74 ExtensionFunctionDispatcher* extension_function_dispatcher_;
75 };
76
77 class GeneratedAPIFunctionRegistry {
78 public:
79 static void RegisterAll(FactoryRegistry* registry) {
80 #for $family in $families
81 #for $f in $family.functions
82 registry->RegisterFunction<${f.class_name}Function>();
83 #end for
84 #end for
85 }
86 };
87
88 } // namespace extensions
89
90 \#endif // $guard
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698