| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_RENDERER_CONTENT_RENDERER_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_ |
| 6 #define CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_ | 6 #define CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 // Embedder API for participating in renderer logic. | 30 // Embedder API for participating in renderer logic. |
| 31 class ContentRendererClient { | 31 class ContentRendererClient { |
| 32 public: | 32 public: |
| 33 virtual ~ContentRendererClient() {} | 33 virtual ~ContentRendererClient() {} |
| 34 | 34 |
| 35 // Notifies us that the RenderThread has been created. | 35 // Notifies us that the RenderThread has been created. |
| 36 virtual void RenderThreadStarted(); | 36 virtual void RenderThreadStarted() = 0; |
| 37 | 37 |
| 38 // Notifies that a new RenderView has been created. | 38 // Notifies that a new RenderView has been created. |
| 39 virtual void RenderViewCreated(RenderView* render_view); | 39 virtual void RenderViewCreated(RenderView* render_view) = 0; |
| 40 | 40 |
| 41 // Sets a number of views/tabs opened in this process. | 41 // Sets a number of views/tabs opened in this process. |
| 42 virtual void SetNumberOfViews(int number_of_views); | 42 virtual void SetNumberOfViews(int number_of_views) = 0; |
| 43 | 43 |
| 44 // Returns the bitmap to show when a plugin crashed, or NULL for none. | 44 // Returns the bitmap to show when a plugin crashed, or NULL for none. |
| 45 virtual SkBitmap* GetSadPluginBitmap(); | 45 virtual SkBitmap* GetSadPluginBitmap() = 0; |
| 46 | 46 |
| 47 // Returns the default text encoding. | 47 // Returns the default text encoding. |
| 48 virtual std::string GetDefaultEncoding(); | 48 virtual std::string GetDefaultEncoding() = 0; |
| 49 | 49 |
| 50 // Create a plugin in the given frame. Can return NULL, in which case | 50 // Create a plugin in the given frame. Can return NULL, in which case |
| 51 // RenderView will create a plugin itself. | 51 // RenderView will create a plugin itself. |
| 52 virtual WebKit::WebPlugin* CreatePlugin( | 52 virtual WebKit::WebPlugin* CreatePlugin( |
| 53 RenderView* render_view, | 53 RenderView* render_view, |
| 54 WebKit::WebFrame* frame, | 54 WebKit::WebFrame* frame, |
| 55 const WebKit::WebPluginParams& params); | 55 const WebKit::WebPluginParams& params) = 0; |
| 56 | 56 |
| 57 // Give the embedder the ability to set an error page. | 57 // Give the embedder the ability to set an error page. |
| 58 virtual void ShowErrorPage(RenderView* render_view, | 58 virtual void ShowErrorPage(RenderView* render_view, |
| 59 WebKit::WebFrame* frame, | 59 WebKit::WebFrame* frame, |
| 60 int http_status_code); | 60 int http_status_code) = 0; |
| 61 | 61 |
| 62 // Returns the html to display when a navigation error occurs. | 62 // Returns the html to display when a navigation error occurs. |
| 63 virtual std::string GetNavigationErrorHtml( | 63 virtual std::string GetNavigationErrorHtml( |
| 64 const WebKit::WebURLRequest& failed_request, | 64 const WebKit::WebURLRequest& failed_request, |
| 65 const WebKit::WebURLError& error); | 65 const WebKit::WebURLError& error) = 0; |
| 66 | 66 |
| 67 // Returns true if the renderer process should schedule the idle handler when | 67 // Returns true if the renderer process should schedule the idle handler when |
| 68 // all widgets are hidden. | 68 // all widgets are hidden. |
| 69 virtual bool RunIdleHandlerWhenWidgetsHidden(); | 69 virtual bool RunIdleHandlerWhenWidgetsHidden() = 0; |
| 70 | 70 |
| 71 // Returns true if the given url can create popup windows. | 71 // Returns true if the given url can create popup windows. |
| 72 virtual bool AllowPopup(const GURL& creator); | 72 virtual bool AllowPopup(const GURL& creator) = 0; |
| 73 | 73 |
| 74 // Returns true if we should fork a new process for the given navigation. | 74 // Returns true if we should fork a new process for the given navigation. |
| 75 virtual bool ShouldFork(WebKit::WebFrame* frame, | 75 virtual bool ShouldFork(WebKit::WebFrame* frame, |
| 76 const GURL& url, | 76 const GURL& url, |
| 77 bool is_content_initiated, | 77 bool is_content_initiated, |
| 78 bool* send_referrer); | 78 bool* send_referrer) = 0; |
| 79 | 79 |
| 80 // Notifies the embedder that the given frame is requesting the resource at | 80 // Notifies the embedder that the given frame is requesting the resource at |
| 81 // |url|. If the function returns true, the url is changed to |new_url|. | 81 // |url|. If the function returns true, the url is changed to |new_url|. |
| 82 virtual bool WillSendRequest(WebKit::WebFrame* frame, | 82 virtual bool WillSendRequest(WebKit::WebFrame* frame, |
| 83 const GURL& url, | 83 const GURL& url, |
| 84 GURL* new_url); | 84 GURL* new_url) = 0; |
| 85 | 85 |
| 86 // Whether to pump events when sending sync cookie messages. Needed if the | 86 // Whether to pump events when sending sync cookie messages. Needed if the |
| 87 // embedder can potentiall put up a modal dialog on the UI thread as a result. | 87 // embedder can potentiall put up a modal dialog on the UI thread as a result. |
| 88 virtual bool ShouldPumpEventsDuringCookieMessage(); | 88 virtual bool ShouldPumpEventsDuringCookieMessage() = 0; |
| 89 | 89 |
| 90 // See the corresponding functions in WebKit::WebFrameClient. | 90 // See the corresponding functions in WebKit::WebFrameClient. |
| 91 virtual void DidCreateScriptContext(WebKit::WebFrame* frame); | 91 virtual void DidCreateScriptContext(WebKit::WebFrame* frame) = 0; |
| 92 virtual void DidDestroyScriptContext(WebKit::WebFrame* frame); | 92 virtual void DidDestroyScriptContext(WebKit::WebFrame* frame) = 0; |
| 93 virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* frame); | 93 virtual void DidCreateIsolatedScriptContext(WebKit::WebFrame* frame) = 0; |
| 94 | 94 |
| 95 // See WebKit::WebKitClient. | 95 // See WebKit::WebKitClient. |
| 96 virtual unsigned long long VisitedLinkHash(const char* canonical_url, | 96 virtual unsigned long long VisitedLinkHash(const char* canonical_url, |
| 97 size_t length); | 97 size_t length) = 0; |
| 98 virtual bool IsLinkVisited(unsigned long long link_hash); | 98 virtual bool IsLinkVisited(unsigned long long link_hash) = 0; |
| 99 virtual void PrefetchHostName(const char* hostname, size_t length); | 99 virtual void PrefetchHostName(const char* hostname, size_t length) = 0; |
| 100 virtual bool ShouldOverridePageVisibilityState( | 100 virtual bool ShouldOverridePageVisibilityState( |
| 101 const RenderView* render_view, | 101 const RenderView* render_view, |
| 102 WebKit::WebPageVisibilityState* override_state) const; | 102 WebKit::WebPageVisibilityState* override_state) const = 0; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace content | 105 } // namespace content |
| 106 | 106 |
| 107 #endif // CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_ | 107 #endif // CONTENT_RENDERER_CONTENT_RENDERER_CLIENT_H_ |
| OLD | NEW |