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_SHELL_SHELL_RENDER_PROCESS_OBSERVER_H_
      6 #define CONTENT_SHELL_SHELL_RENDER_PROCESS_OBSERVER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "base/files/file_path.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "content/public/renderer/render_process_observer.h"
     13 #include "ipc/ipc_platform_file.h"
     14 
     15 namespace WebKit {
     16 class WebFrame;
     17 }
     18 
     19 namespace WebTestRunner {
     20 class WebTestDelegate;
     21 class WebTestInterfaces;
     22 }
     23 
     24 namespace content {
     25 
     26 class RenderView;
     27 class WebKitTestRunner;
     28 
     29 class ShellRenderProcessObserver : public RenderProcessObserver {
     30  public:
     31   static ShellRenderProcessObserver* GetInstance();
     32 
     33   ShellRenderProcessObserver();
     34   virtual ~ShellRenderProcessObserver();
     35 
     36   void SetTestDelegate(WebTestRunner::WebTestDelegate* delegate);
     37   void SetMainWindow(RenderView* view);
     38 
     39   // RenderProcessObserver implementation.
     40   virtual void WebKitInitialized() OVERRIDE;
     41   virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
     42 
     43   WebTestRunner::WebTestDelegate* test_delegate() const {
     44     return test_delegate_;
     45   }
     46   WebTestRunner::WebTestInterfaces* test_interfaces() const {
     47     return test_interfaces_.get();
     48   }
     49   WebKitTestRunner* main_test_runner() const { return main_test_runner_; }
     50   const base::FilePath& webkit_source_dir() const { return webkit_source_dir_; }
     51 
     52  private:
     53   // Message handlers.
     54   void OnResetAll();
     55   void OnSetWebKitSourceDir(const base::FilePath& webkit_source_dir);
     56 
     57   WebKitTestRunner* main_test_runner_;
     58   WebTestRunner::WebTestDelegate* test_delegate_;
     59   scoped_ptr<WebTestRunner::WebTestInterfaces> test_interfaces_;
     60 
     61   base::FilePath webkit_source_dir_;
     62 
     63   DISALLOW_COPY_AND_ASSIGN(ShellRenderProcessObserver);
     64 };
     65 
     66 }  // namespace content
     67 
     68 #endif  // CONTENT_SHELL_SHELL_RENDER_PROCESS_OBSERVER_H_
     69