OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
7 | 7 |
8 #include "content/public/browser/browser_plugin_guest_delegate.h" | 8 #include "content/public/browser/browser_plugin_guest_delegate.h" |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "content/public/browser/web_contents_observer.h" |
11 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 class BrowserPluginGuest; | 17 class BrowserPluginGuest; |
17 struct Referrer; | 18 struct Referrer; |
18 | 19 |
19 class TestBrowserPluginGuestDelegate : public BrowserPluginGuestDelegate { | 20 class TestBrowserPluginGuestDelegate : public BrowserPluginGuestDelegate, |
| 21 public WebContentsObserver { |
20 public: | 22 public: |
21 explicit TestBrowserPluginGuestDelegate(BrowserPluginGuest* guest); | 23 explicit TestBrowserPluginGuestDelegate(BrowserPluginGuest* guest); |
22 virtual ~TestBrowserPluginGuestDelegate(); | 24 virtual ~TestBrowserPluginGuestDelegate(); |
23 | 25 |
24 void ResetStates(); | 26 WebContents* GetEmbedderWebContents() const; |
25 | 27 |
26 private: | 28 private: |
| 29 class EmbedderWebContentsObserver; |
| 30 |
27 void LoadURLWithParams(const GURL& url, | 31 void LoadURLWithParams(const GURL& url, |
28 const Referrer& referrer, | 32 const Referrer& referrer, |
29 PageTransition transition_type, | 33 PageTransition transition_type, |
30 WebContents* web_contents); | 34 WebContents* web_contents); |
31 | 35 |
| 36 // WebContentsObserver implementation. |
| 37 virtual void WebContentsDestroyed() OVERRIDE; |
| 38 |
32 // Overridden from BrowserPluginGuestDelegate: | 39 // Overridden from BrowserPluginGuestDelegate: |
| 40 virtual void DidAttach() OVERRIDE; |
33 virtual void Destroy() OVERRIDE; | 41 virtual void Destroy() OVERRIDE; |
34 virtual void NavigateGuest(const std::string& src) OVERRIDE; | 42 virtual void NavigateGuest(const std::string& src) OVERRIDE; |
35 virtual void RegisterDestructionCallback( | 43 virtual void RegisterDestructionCallback( |
36 const DestructionCallback& callback) OVERRIDE; | 44 const DestructionCallback& callback) OVERRIDE; |
37 | 45 |
38 BrowserPluginGuest* guest_; | 46 BrowserPluginGuest* guest_; |
| 47 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; |
39 | 48 |
40 DestructionCallback destruction_callback_; | 49 DestructionCallback destruction_callback_; |
41 | 50 |
42 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuestDelegate); | 51 DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuestDelegate); |
43 }; | 52 }; |
44 | 53 |
45 } // namespace content | 54 } // namespace content |
46 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_DELEGATE_H_ | 55 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_DELEGATE_H_ |
OLD | NEW |