| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ | 5 #ifndef CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
| 6 #define CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ | 6 #define CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
| 7 | 7 |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // a particular <webview>. | 24 // a particular <webview>. |
| 25 class WebViewGuest : public content::WebContentsObserver { | 25 class WebViewGuest : public content::WebContentsObserver { |
| 26 public: | 26 public: |
| 27 WebViewGuest(content::WebContents* guest_web_contents, | 27 WebViewGuest(content::WebContents* guest_web_contents, |
| 28 content::WebContents* embedder_web_contents, | 28 content::WebContents* embedder_web_contents, |
| 29 const std::string& extension_id, | 29 const std::string& extension_id, |
| 30 int webview_instance_id); | 30 int webview_instance_id); |
| 31 | 31 |
| 32 static WebViewGuest* From(int embedder_process_id, int instance_id); | 32 static WebViewGuest* From(int embedder_process_id, int instance_id); |
| 33 | 33 |
| 34 void DispatchEvent(const std::string& event_name, |
| 35 scoped_ptr<DictionaryValue> event); |
| 36 |
| 34 content::WebContents* embedder_web_contents() const { | 37 content::WebContents* embedder_web_contents() const { |
| 35 return embedder_web_contents_; | 38 return embedder_web_contents_; |
| 36 } | 39 } |
| 37 | 40 |
| 38 content::WebContents* web_contents() const { | 41 content::WebContents* web_contents() const { |
| 39 return WebContentsObserver::web_contents(); | 42 return WebContentsObserver::web_contents(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 int instance_id() const { return webview_instance_id_; } | 45 int instance_id() const { return webview_instance_id_; } |
| 43 | 46 |
| 44 extensions::ScriptExecutor* script_executor() { | 47 extensions::ScriptExecutor* script_executor() { |
| 45 return script_executor_.get(); | 48 return script_executor_.get(); |
| 46 } | 49 } |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 virtual ~WebViewGuest(); | 52 virtual ~WebViewGuest(); |
| 53 |
| 54 virtual void DidCommitProvisionalLoadForFrame( |
| 55 int64 frame_id, |
| 56 bool is_main_frame, |
| 57 const GURL& url, |
| 58 content::PageTransition transition_type, |
| 59 content::RenderViewHost* render_view_host) OVERRIDE; |
| 50 virtual void WebContentsDestroyed( | 60 virtual void WebContentsDestroyed( |
| 51 content::WebContents* web_contents) OVERRIDE; | 61 content::WebContents* web_contents) OVERRIDE; |
| 52 | 62 |
| 53 void AddWebViewToExtensionRendererState(); | 63 void AddWebViewToExtensionRendererState(); |
| 54 static void RemoveWebViewFromExtensionRendererState( | 64 static void RemoveWebViewFromExtensionRendererState( |
| 55 content::WebContents* web_contents); | 65 content::WebContents* web_contents); |
| 56 | 66 |
| 57 content::WebContents* embedder_web_contents_; | 67 content::WebContents* embedder_web_contents_; |
| 58 const std::string extension_id_; | 68 const std::string extension_id_; |
| 59 const int embedder_render_process_id_; | 69 const int embedder_render_process_id_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 script_observers_; | 81 script_observers_; |
| 72 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 82 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
| 73 | 83 |
| 74 | 84 |
| 75 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 85 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 76 }; | 86 }; |
| 77 | 87 |
| 78 } // namespace chrome | 88 } // namespace chrome |
| 79 | 89 |
| 80 #endif // CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ | 90 #endif // CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
| OLD | NEW |