Home | History | Annotate | Download | only in renderer
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_RENDERER_RENDER_PROCESS_H_
      6 #define CONTENT_RENDERER_RENDER_PROCESS_H_
      7 
      8 #include "content/child/child_process.h"
      9 
     10 namespace content {
     11 
     12 // A abstract interface representing the renderer end of the browser<->renderer
     13 // connection. The opposite end is the RenderProcessHost. This is a singleton
     14 // object for each renderer.
     15 //
     16 // RenderProcessImpl implements this interface for the regular browser.
     17 // MockRenderProcess implements this interface for certain tests, especially
     18 // ones derived from RenderViewTest.
     19 class RenderProcess : public ChildProcess {
     20  public:
     21   RenderProcess() {}
     22   virtual ~RenderProcess() {}
     23 
     24   // Keep track of the cumulative set of enabled bindings for this process,
     25   // across any view.
     26   virtual void AddBindings(int bindings) = 0;
     27 
     28   // The cumulative set of enabled bindings for this process.
     29   virtual int GetEnabledBindings() const = 0;
     30 
     31   // Returns a pointer to the RenderProcess singleton instance. Assuming that
     32   // we're actually a renderer or a renderer test, this static cast will
     33   // be correct.
     34   static RenderProcess* current() {
     35     return static_cast<RenderProcess*>(ChildProcess::current());
     36   }
     37 
     38  private:
     39   DISALLOW_COPY_AND_ASSIGN(RenderProcess);
     40 };
     41 
     42 }  // namespace content
     43 
     44 #endif  // CONTENT_RENDERER_RENDER_PROCESS_H_
     45