"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/extensions/webkit_script_runtime/webkit_script_runtime.cc" (11 May 2009, 1791 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2   Copyright 2008 Google Inc.
    3 
    4   Licensed under the Apache License, Version 2.0 (the "License");
    5   you may not use this file except in compliance with the License.
    6   You may obtain a copy of the License at
    7 
    8        http://www.apache.org/licenses/LICENSE-2.0
    9 
   10   Unless required by applicable law or agreed to in writing, software
   11   distributed under the License is distributed on an "AS IS" BASIS,
   12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13   See the License for the specific language governing permissions and
   14   limitations under the License.
   15 */
   16 
   17 #include <ggadget/logger.h>
   18 #include <ggadget/script_runtime_manager.h>
   19 #include "js_script_runtime.h"
   20 
   21 #define Initialize webkit_script_runtime_LTX_Initialize
   22 #define Finalize webkit_script_runtime_LTX_Finalize
   23 #define RegisterScriptRuntimeExtension \
   24     webkit_script_runtime_LTX_RegisterScriptRuntimeExtension
   25 
   26 using ggadget::ScriptRuntimeManager;
   27 using ggadget::webkit::JSScriptRuntime;
   28 
   29 static JSScriptRuntime *g_webkit_script_runtime_ = NULL;
   30 
   31 extern "C" {
   32   bool Initialize() {
   33     LOGI("Initialize webkit_script_runtime extension.");
   34     return true;
   35   }
   36 
   37   void Finalize() {
   38     LOGI("Finalize webkit_script_runtime extension.");
   39     delete g_webkit_script_runtime_;
   40     g_webkit_script_runtime_ = NULL;
   41   }
   42 
   43   bool RegisterScriptRuntimeExtension(ScriptRuntimeManager *manager) {
   44     LOGI("Register webkit_script_runtime extension.");
   45     if (manager) {
   46       if (!g_webkit_script_runtime_)
   47         g_webkit_script_runtime_ = new JSScriptRuntime();
   48 
   49       manager->RegisterScriptRuntime("js", g_webkit_script_runtime_);
   50 
   51       // Special handle for gtkwebkit_browser_element.
   52       manager->RegisterScriptRuntime("webkitjs", g_webkit_script_runtime_);
   53       return true;
   54     }
   55     return false;
   56   }
   57 }