| OLD | NEW |
| (Empty) | |
| 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_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H__ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H__ |
| 7 #pragma once |
| 8 |
| 9 #include "base/hash_tables.h" |
| 10 #include "content/browser/browser_plugin/renderer_host/browser_plugin_message_fi
lter.h" |
| 11 #include "content/public/browser/notification_registrar.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/web_contents_observer.h" |
| 14 |
| 15 class BrowserPluginWebContentsObserver: public content::WebContentsObserver, |
| 16 public content::NotificationObserver { |
| 17 public: |
| 18 typedef base::hash_set<content::WebContents*, |
| 19 hash_web_contents> GuestSet; |
| 20 typedef base::hash_map<content::WebContents*, |
| 21 int64, |
| 22 hash_web_contents> GuestMap; |
| 23 |
| 24 virtual ~BrowserPluginWebContentsObserver(); |
| 25 |
| 26 static BrowserPluginWebContentsObserver* Create( |
| 27 content::WebContents* web_contents); |
| 28 |
| 29 void AddGuest(content::WebContents* guest, int64 frame_id); |
| 30 |
| 31 void RemoveGuest(content::WebContents* guest); |
| 32 |
| 33 virtual void DidCommitProvisionalLoadForFrame( |
| 34 int64 frame_id, |
| 35 bool is_main_frame, |
| 36 const GURL& url, |
| 37 content::PageTransition transition_type) OVERRIDE; |
| 38 |
| 39 virtual void RenderViewDeleted( |
| 40 content::RenderViewHost* render_view_host) OVERRIDE; |
| 41 |
| 42 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 43 |
| 44 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; |
| 45 |
| 46 private: |
| 47 BrowserPluginWebContentsObserver( |
| 48 content::WebContents* web_contents); |
| 49 |
| 50 void DestroyGuests(); |
| 51 |
| 52 // content::NotificationObserver method override. |
| 53 virtual void Observe(int type, |
| 54 const content::NotificationSource& source, |
| 55 const content::NotificationDetails& details) OVERRIDE; |
| 56 |
| 57 // A scoped container for notification registries. |
| 58 content::NotificationRegistrar registrar_; |
| 59 |
| 60 GuestMap guests_; |
| 61 }; |
| 62 |
| 63 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_WEB_CONTENTS_OBSERVER_H
_ |
| OLD | NEW |