1 // Copyright (c) 2011 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 CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_VIEW_HOST_OBSERVER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_VIEW_HOST_OBSERVER_H_ 7 8 #include <string> 9 10 #include "content/public/browser/render_view_host_observer.h" 11 12 class Profile; 13 class SkBitmap; 14 15 namespace chrome_browser_net { 16 class Predictor; 17 } 18 19 namespace extensions { 20 class Extension; 21 } 22 23 // This class holds the Chrome specific parts of RenderViewHost, and has the 24 // same lifetime. 25 class ChromeRenderViewHostObserver : public content::RenderViewHostObserver { 26 public: 27 ChromeRenderViewHostObserver(content::RenderViewHost* render_view_host, 28 chrome_browser_net::Predictor* predictor); 29 virtual ~ChromeRenderViewHostObserver(); 30 31 // content::RenderViewHostObserver overrides. 32 virtual void RenderViewHostInitialized() OVERRIDE; 33 virtual void RenderViewHostDestroyed(content::RenderViewHost* rvh) OVERRIDE; 34 virtual void Navigate(const GURL& url) OVERRIDE; 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 36 37 private: 38 // Does extension-specific initialization when a new renderer process is 39 // created by a RenderViewHost. 40 void InitRenderViewForExtensions(); 41 // Gets the extension or app (if any) that is associated with the RVH. 42 const extensions::Extension* GetExtension(); 43 // Cleans up when a RenderViewHost is removed, or on destruction. 44 void RemoveRenderViewHostForExtensions(content::RenderViewHost* rvh); 45 46 void OnFocusedNodeTouched(bool editable); 47 48 void OnRequestThumbnailForContextNodeACK(const SkBitmap& bitmap); 49 50 Profile* profile_; 51 chrome_browser_net::Predictor* predictor_; 52 53 DISALLOW_COPY_AND_ASSIGN(ChromeRenderViewHostObserver); 54 }; 55 56 #endif // CHROME_BROWSER_RENDERER_HOST_CHROME_RENDER_VIEW_HOST_OBSERVER_H_ 57