| 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 CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 std::string* partition_domain, | 69 std::string* partition_domain, |
| 70 std::string* partition_name, | 70 std::string* partition_name, |
| 71 bool* in_memory); | 71 bool* in_memory); |
| 72 | 72 |
| 73 // By default, JavaScript and images are enabled in guest content. | 73 // By default, JavaScript and images are enabled in guest content. |
| 74 static void GetDefaultContentSettingRules(RendererContentSettingRules* rules, | 74 static void GetDefaultContentSettingRules(RendererContentSettingRules* rules, |
| 75 bool incognito); | 75 bool incognito); |
| 76 | 76 |
| 77 virtual const char* GetViewType() const = 0; | 77 virtual const char* GetViewType() const = 0; |
| 78 | 78 |
| 79 // This method can be overriden by subclasses. This method is called when |
| 80 // the initial set of frames within the page have completed loading. |
| 81 virtual void DidStopLoading() {} |
| 82 |
| 79 // This method can be overridden by subclasses. It indicates that this guest's | 83 // This method can be overridden by subclasses. It indicates that this guest's |
| 80 // embedder has been destroyed and the guest will be destroyed shortly. This | 84 // embedder has been destroyed and the guest will be destroyed shortly. This |
| 81 // method gives derived classes the opportunity to perform some cleanup. | 85 // method gives derived classes the opportunity to perform some cleanup. |
| 82 virtual void EmbedderDestroyed() {} | 86 virtual void EmbedderDestroyed() {} |
| 83 | 87 |
| 88 // This method queries whether drag-and-drop is enabled for this particular |
| 89 // view. By default, drag-and-drop is disabled. Derived classes can override |
| 90 // this behavior to enable drag-and-drop. |
| 91 virtual bool IsDragAndDropEnabled() const; |
| 92 |
| 84 bool IsViewType(const char* const view_type) const { | 93 bool IsViewType(const char* const view_type) const { |
| 85 return !strcmp(GetViewType(), view_type); | 94 return !strcmp(GetViewType(), view_type); |
| 86 } | 95 } |
| 87 | 96 |
| 88 base::WeakPtr<GuestViewBase> AsWeakPtr(); | 97 base::WeakPtr<GuestViewBase> AsWeakPtr(); |
| 89 | 98 |
| 90 virtual void Attach(content::WebContents* embedder_web_contents, | 99 virtual void Attach(content::WebContents* embedder_web_contents, |
| 91 const base::DictionaryValue& args); | 100 const base::DictionaryValue& args); |
| 92 | 101 |
| 93 content::WebContents* embedder_web_contents() const { | 102 content::WebContents* embedder_web_contents() const { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Returns the embedder's process ID. | 137 // Returns the embedder's process ID. |
| 129 int embedder_render_process_id() const { return embedder_render_process_id_; } | 138 int embedder_render_process_id() const { return embedder_render_process_id_; } |
| 130 | 139 |
| 131 GuestViewBase* GetOpener() const { | 140 GuestViewBase* GetOpener() const { |
| 132 return opener_.get(); | 141 return opener_.get(); |
| 133 } | 142 } |
| 134 | 143 |
| 135 void SetOpener(GuestViewBase* opener); | 144 void SetOpener(GuestViewBase* opener); |
| 136 | 145 |
| 137 // WebContentsObserver implementation. | 146 // WebContentsObserver implementation. |
| 147 virtual void DidStopLoading( |
| 148 content::RenderViewHost* render_view_host) OVERRIDE FINAL; |
| 138 virtual void WebContentsDestroyed() OVERRIDE; | 149 virtual void WebContentsDestroyed() OVERRIDE; |
| 139 | 150 |
| 140 // WebContentsDelegate implementation. | 151 // WebContentsDelegate implementation. |
| 141 virtual bool ShouldFocusPageAfterCrash() OVERRIDE; | 152 virtual bool ShouldFocusPageAfterCrash() OVERRIDE; |
| 142 virtual bool PreHandleGestureEvent( | 153 virtual bool PreHandleGestureEvent( |
| 143 content::WebContents* source, | 154 content::WebContents* source, |
| 144 const blink::WebGestureEvent& event) OVERRIDE; | 155 const blink::WebGestureEvent& event) OVERRIDE; |
| 145 | 156 |
| 146 // BrowserPluginGuestDelegate implementation. | 157 // BrowserPluginGuestDelegate implementation. |
| 147 virtual void Destroy() OVERRIDE; | 158 virtual void Destroy() OVERRIDE; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; | 201 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; |
| 191 | 202 |
| 192 // This is used to ensure pending tasks will not fire after this object is | 203 // This is used to ensure pending tasks will not fire after this object is |
| 193 // destroyed. | 204 // destroyed. |
| 194 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 205 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
| 195 | 206 |
| 196 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 207 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
| 197 }; | 208 }; |
| 198 | 209 |
| 199 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 210 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
| OLD | NEW |