OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/process_util.h" | 13 #include "base/process_util.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "chrome/common/content_settings_types.h" | 16 #include "chrome/common/content_settings_types.h" |
17 #include "chrome/common/dom_storage_common.h" | 17 #include "chrome/common/dom_storage_common.h" |
18 #include "chrome/common/translate_errors.h" | 18 #include "chrome/common/translate_errors.h" |
19 #include "chrome/common/view_types.h" | 19 #include "chrome/common/view_types.h" |
20 #include "chrome/common/window_container_type.h" | 20 #include "chrome/common/window_container_type.h" |
21 #include "ipc/ipc_channel.h" | |
21 #include "net/base/load_states.h" | 22 #include "net/base/load_states.h" |
22 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" |
23 #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" |
24 #include "webkit/glue/window_open_disposition.h" | 25 #include "webkit/glue/window_open_disposition.h" |
25 | 26 |
26 | 27 |
27 class AutomationResourceRoutingDelegate; | 28 class AutomationResourceRoutingDelegate; |
28 class BackgroundContents; | 29 class BackgroundContents; |
29 struct BookmarkNodeData; | 30 struct BookmarkNodeData; |
30 class BookmarkNode; | 31 class BookmarkNode; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 // | 88 // |
88 // An interface implemented by an object interested in knowing about the state | 89 // An interface implemented by an object interested in knowing about the state |
89 // of the RenderViewHost. | 90 // of the RenderViewHost. |
90 // | 91 // |
91 // This interface currently encompasses every type of message that was | 92 // This interface currently encompasses every type of message that was |
92 // previously being sent by TabContents itself. Some of these notifications | 93 // previously being sent by TabContents itself. Some of these notifications |
93 // may not be relevant to all users of RenderViewHost and we should consider | 94 // may not be relevant to all users of RenderViewHost and we should consider |
94 // exposing a more generic Send function on RenderViewHost and a response | 95 // exposing a more generic Send function on RenderViewHost and a response |
95 // listener here to serve that need. | 96 // listener here to serve that need. |
96 // | 97 // |
97 class RenderViewHostDelegate { | 98 class RenderViewHostDelegate : public IPC::Channel::Listener { |
98 public: | 99 public: |
99 // View ---------------------------------------------------------------------- | 100 // View ---------------------------------------------------------------------- |
100 // Functions that can be routed directly to a view-specific class. | 101 // Functions that can be routed directly to a view-specific class. |
101 | 102 |
102 class View { | 103 class View { |
103 public: | 104 public: |
104 // The page is trying to open a new page (e.g. a popup window). The | 105 // The page is trying to open a new page (e.g. a popup window). The |
105 // window should be created associated with the given route, but it should | 106 // window should be created associated with the given route, but it should |
106 // not be shown yet. That should happen in response to ShowCreatedWindow. | 107 // not be shown yet. That should happen in response to ShowCreatedWindow. |
107 // |window_container_type| describes the type of RenderViewHost container | 108 // |window_container_type| describes the type of RenderViewHost container |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 int32 page_id, | 316 int32 page_id, |
316 const std::vector<std::string>& result) = 0; | 317 const std::vector<std::string>& result) = 0; |
317 | 318 |
318 // Notification of whether the page supports instant-style interaction. | 319 // Notification of whether the page supports instant-style interaction. |
319 virtual void OnInstantSupportDetermined(int32 page_id, bool result) = 0; | 320 virtual void OnInstantSupportDetermined(int32 page_id, bool result) = 0; |
320 | 321 |
321 protected: | 322 protected: |
322 virtual ~BrowserIntegration() {} | 323 virtual ~BrowserIntegration() {} |
323 }; | 324 }; |
324 | 325 |
325 // Resource ------------------------------------------------------------------ | |
326 // Notifications of resource loading events. | |
327 | |
328 class Resource { | |
329 public: | |
330 // The RenderView is starting a provisional load. | |
331 virtual void DidStartProvisionalLoadForFrame( | |
332 RenderViewHost* render_view_host, | |
333 int64 frame_id, | |
334 bool is_main_frame, | |
335 bool is_error_page, | |
336 const GURL& url) = 0; | |
337 | |
338 // Notification by the resource loading system (not the renderer) that it | |
339 // has started receiving a resource response. This is different than | |
340 // DidStartProvisionalLoadForFrame above because this is called for every | |
341 // resource (images, automatically loaded subframes, etc.) and provisional | |
342 // loads are only for user-initiated navigations. | |
343 virtual void DidStartReceivingResourceResponse( | |
344 const ResourceRequestDetails& details) = 0; | |
345 | |
346 // Sent when a provisional load is redirected. | |
347 virtual void DidRedirectProvisionalLoad(int32 page_id, | |
348 const GURL& source_url, | |
349 const GURL& target_url) = 0; | |
350 | |
351 // Notification by the resource loading system (not the renderer) that a | |
352 // resource was redirected. This is different than | |
353 // DidRedirectProvisionalLoad above because this is called for every | |
354 // resource (images, automatically loaded subframes, etc.) and provisional | |
355 // loads are only for user-initiated navigations. | |
356 virtual void DidRedirectResource( | |
357 const ResourceRedirectDetails& details) = 0; | |
358 | |
359 // The RenderView loaded a resource from an in-memory cache. | |
360 // |security_info| contains the security info if this resource was | |
361 // originally loaded over a secure connection. | |
362 virtual void DidLoadResourceFromMemoryCache( | |
363 const GURL& url, | |
364 const std::string& frame_origin, | |
365 const std::string& main_frame_origin, | |
366 const std::string& security_info) = 0; | |
367 | |
368 virtual void DidDisplayInsecureContent() = 0; | |
369 virtual void DidRunInsecureContent(const std::string& security_origin) = 0; | |
370 | |
371 // The RenderView failed a provisional load with an error. | |
372 virtual void DidFailProvisionalLoadWithError( | |
373 RenderViewHost* render_view_host, | |
374 int64 frame_id, | |
375 bool is_main_frame, | |
376 int error_code, | |
377 const GURL& url, | |
378 bool showing_repost_interstitial) = 0; | |
379 | |
380 // Notification that a document has been loaded in a frame. | |
381 virtual void DocumentLoadedInFrame(int64 frame_id) = 0; | |
382 | |
383 // Notification that a frame finished loading. | |
384 virtual void DidFinishLoad(int64 frame_id) = 0; | |
385 | |
386 protected: | |
387 virtual ~Resource() {} | |
388 }; | |
389 | |
390 // ContentSettings------------------------------------------------------------ | 326 // ContentSettings------------------------------------------------------------ |
391 // Interface for content settings related events. | 327 // Interface for content settings related events. |
392 | 328 |
393 class ContentSettings { | 329 class ContentSettings { |
394 public: | 330 public: |
395 // Called when content in the current page was blocked due to the user's | 331 // Called when content in the current page was blocked due to the user's |
396 // content settings. | 332 // content settings. |
397 virtual void OnContentBlocked(ContentSettingsType type, | 333 virtual void OnContentBlocked(ContentSettingsType type, |
398 const std::string& resource_identifier) = 0; | 334 const std::string& resource_identifier) = 0; |
399 | 335 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 virtual ~FileSelect() {} | 601 virtual ~FileSelect() {} |
666 }; | 602 }; |
667 | 603 |
668 // --------------------------------------------------------------------------- | 604 // --------------------------------------------------------------------------- |
669 | 605 |
670 // Returns the current delegate associated with a feature. May return NULL if | 606 // Returns the current delegate associated with a feature. May return NULL if |
671 // there is no corresponding delegate. | 607 // there is no corresponding delegate. |
672 virtual View* GetViewDelegate(); | 608 virtual View* GetViewDelegate(); |
673 virtual RendererManagement* GetRendererManagementDelegate(); | 609 virtual RendererManagement* GetRendererManagementDelegate(); |
674 virtual BrowserIntegration* GetBrowserIntegrationDelegate(); | 610 virtual BrowserIntegration* GetBrowserIntegrationDelegate(); |
675 virtual Resource* GetResourceDelegate(); | |
676 virtual ContentSettings* GetContentSettingsDelegate(); | 611 virtual ContentSettings* GetContentSettingsDelegate(); |
677 virtual Save* GetSaveDelegate(); | 612 virtual Save* GetSaveDelegate(); |
678 virtual Printing* GetPrintingDelegate(); | 613 virtual Printing* GetPrintingDelegate(); |
679 virtual FavIcon* GetFavIconDelegate(); | 614 virtual FavIcon* GetFavIconDelegate(); |
680 virtual Autocomplete* GetAutocompleteDelegate(); | 615 virtual Autocomplete* GetAutocompleteDelegate(); |
681 virtual AutoFill* GetAutoFillDelegate(); | 616 virtual AutoFill* GetAutoFillDelegate(); |
682 virtual BookmarkDrag* GetBookmarkDragDelegate(); | 617 virtual BookmarkDrag* GetBookmarkDragDelegate(); |
683 virtual SSL* GetSSLDelegate(); | 618 virtual SSL* GetSSLDelegate(); |
684 virtual FileSelect* GetFileSelectDelegate(); | 619 virtual FileSelect* GetFileSelectDelegate(); |
685 | 620 |
686 // Return the delegate for registering RenderViewHosts for automation resource | 621 // Return the delegate for registering RenderViewHosts for automation resource |
687 // routing. | 622 // routing. |
688 virtual AutomationResourceRoutingDelegate* | 623 virtual AutomationResourceRoutingDelegate* |
689 GetAutomationResourceRoutingDelegate(); | 624 GetAutomationResourceRoutingDelegate(); |
690 | 625 |
626 // IPC::Channel::Listener implementation. | |
627 // This is used to give the delegate a chance to filter IPC messages. | |
brettw
2010/12/29 20:20:34
Can you also say something like "this will get cal
jam
2010/12/29 21:52:47
isn't the concept of message filtering spread all
| |
628 virtual bool OnMessageReceived(const IPC::Message& message); | |
629 | |
691 // Gets the URL that is currently being displayed, if there is one. | 630 // Gets the URL that is currently being displayed, if there is one. |
692 virtual const GURL& GetURL() const; | 631 virtual const GURL& GetURL() const; |
693 | 632 |
694 // Return this object cast to a TabContents, if it is one. If the object is | 633 // Return this object cast to a TabContents, if it is one. If the object is |
695 // not a TabContents, returns NULL. | 634 // not a TabContents, returns NULL. |
696 virtual TabContents* GetAsTabContents(); | 635 virtual TabContents* GetAsTabContents(); |
697 | 636 |
698 // Return this object cast to a BackgroundContents, if it is one. If the | 637 // Return this object cast to a BackgroundContents, if it is one. If the |
699 // object is not a BackgroundContents, returns NULL. | 638 // object is not a BackgroundContents, returns NULL. |
700 virtual BackgroundContents* GetAsBackgroundContents(); | 639 virtual BackgroundContents* GetAsBackgroundContents(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
884 bool remember) {} | 823 bool remember) {} |
885 | 824 |
886 // Update the content restrictions, i.e. disable print/copy. | 825 // Update the content restrictions, i.e. disable print/copy. |
887 virtual void UpdateContentRestrictions(int restrictions) {} | 826 virtual void UpdateContentRestrictions(int restrictions) {} |
888 | 827 |
889 protected: | 828 protected: |
890 virtual ~RenderViewHostDelegate() {} | 829 virtual ~RenderViewHostDelegate() {} |
891 }; | 830 }; |
892 | 831 |
893 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ | 832 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_VIEW_HOST_DELEGATE_H_ |
OLD | NEW |