| OLD | NEW | 
| (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. The source is here: | 
 |   6 // | 
 |   7 // chrome/renderer/extensions/generated_bindings.h.tmpl | 
 |   8  | 
 |   9 \#ifndef $guard | 
 |  10 \#define $guard | 
 |  11 \#pragma once | 
 |  12  | 
 |  13 \#include "base/stringprintf.h" | 
 |  14 \#include "chrome/common/extensions/api/generated_messages.h" | 
 |  15 \#include "chrome/renderer/extensions/extension_dispatcher.h" | 
 |  16 \#include "chrome/renderer/extensions/schema_generated_bindings.h" | 
 |  17 \#include "content/public/renderer/render_view.h" | 
 |  18  | 
 |  19 class GeneratedBindings { | 
 |  20 public: | 
 |  21   static bool Handle(content::RenderView* renderview, | 
 |  22                      const std::string& name, | 
 |  23                      int request_id, | 
 |  24                      ListValue* value_args) { | 
 |  25 #for $family in $families | 
 |  26 #for $function in $family.functions | 
 |  27     if (name == "$function.dotted_name") { | 
 |  28 #for $arg in $function.arguments | 
 |  29      $arg.mapped_type() $arg.name; | 
 |  30 #end for | 
 |  31       renderview->Send(new ExtensionAPIHostMsg_${function.class_name}( | 
 |  32           renderview->GetRoutingId(), request_id#for $arg in $function.arguments
    #, | 
 |  33           $arg.name#end for#)); | 
 |  34       return true; | 
 |  35     } | 
 |  36 #end for | 
 |  37 #end for | 
 |  38     return false; | 
 |  39   } | 
 |  40 }; | 
 |  41  | 
 |  42 class GeneratedExtensionHelper { | 
 |  43  public: | 
 |  44   GeneratedExtensionHelper(ExtensionDispatcher* extension_dispatcher) | 
 |  45       : extension_dispatcher_(extension_dispatcher) { | 
 |  46   } | 
 |  47  | 
 |  48   bool OnMessageReceived(const IPC::Message& message) { | 
 |  49     bool handled = true; | 
 |  50     IPC_BEGIN_MESSAGE_MAP(GeneratedExtensionHelper, message) | 
 |  51 #for $family in $families | 
 |  52 #for $function in $family.functions | 
 |  53       IPC_MESSAGE_HANDLER(ExtensionAPIViewMsg_${function.class_name}Response, On
    ${function.class_name}Response) | 
 |  54 #end for | 
 |  55 #end for | 
 |  56       IPC_MESSAGE_UNHANDLED(handled = false) | 
 |  57       IPC_END_MESSAGE_MAP() | 
 |  58       return handled; | 
 |  59   } | 
 |  60  | 
 |  61  private: | 
 |  62 #for $family in $families | 
 |  63 #for $function in $family.functions | 
 |  64   void On${function.class_name}Response( | 
 |  65       int request_id, | 
 |  66       int result) { | 
 |  67     std::string extension_id; | 
 |  68     extensions::SchemaGeneratedBindings::HandleResponse( | 
 |  69         extension_dispatcher_->v8_context_set(), request_id, true, | 
 |  70         base::StringPrintf("%d", result), "", &extension_id); | 
 |  71 } | 
 |  72  | 
 |  73 #end for | 
 |  74 #end for | 
 |  75  | 
 |  76   ExtensionDispatcher* extension_dispatcher_; | 
 |  77 }; | 
 |  78  | 
 |  79 \#endif  // $guard | 
| OLD | NEW |