Chromium Code Reviews| 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_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/jsmessage_box_client.h" | 10 #include "chrome/browser/jsmessage_box_client.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 // have any visible display. Its navigation is not managed by a | 24 // have any visible display. Its navigation is not managed by a |
| 25 // NavigationController because is has no facility for navigating (other than | 25 // NavigationController because is has no facility for navigating (other than |
| 26 // programatically view window.location.href) or RenderViewHostManager because | 26 // programatically view window.location.href) or RenderViewHostManager because |
| 27 // it is never allowed to navigate across a SiteInstance boundary. | 27 // it is never allowed to navigate across a SiteInstance boundary. |
| 28 class BackgroundContents : public RenderViewHostDelegate, | 28 class BackgroundContents : public RenderViewHostDelegate, |
| 29 public RenderViewHostDelegate::View, | 29 public RenderViewHostDelegate::View, |
| 30 public NotificationObserver, | 30 public NotificationObserver, |
| 31 public JavaScriptMessageBoxClient { | 31 public JavaScriptMessageBoxClient { |
| 32 public: | 32 public: |
| 33 BackgroundContents(SiteInstance* site_instance, | 33 BackgroundContents(SiteInstance* site_instance, |
| 34 int routing_id); | 34 int routing_id, |
| 35 const string16& frame_name); | |
| 35 ~BackgroundContents(); | 36 ~BackgroundContents(); |
| 36 | 37 |
| 37 // Provide access to the RenderViewHost for the | 38 // Provide access to the RenderViewHost for the |
| 38 // RenderViewHostDelegateViewHelper | 39 // RenderViewHostDelegateViewHelper |
| 39 RenderViewHost* render_view_host() { return render_view_host_; } | 40 RenderViewHost* render_view_host() { return render_view_host_; } |
| 40 | 41 |
| 41 // RenderViewHostDelegate implementation. | 42 // RenderViewHostDelegate implementation. |
| 42 virtual RenderViewHostDelegate::View* GetViewDelegate() { return this; } | 43 virtual RenderViewHostDelegate::View* GetViewDelegate() { return this; } |
| 43 virtual const GURL& GetURL() const { return url_; } | 44 virtual const GURL& GetURL() const { return url_; } |
| 44 virtual ViewType::Type GetRenderViewType() const { | 45 virtual ViewType::Type GetRenderViewType() const { |
| 45 return ViewType::BACKGROUND_CONTENTS; | 46 return ViewType::BACKGROUND_CONTENTS; |
| 46 } | 47 } |
| 48 | |
| 49 virtual string16 GetRenderViewFrameName() const { | |
| 50 return frame_name_; | |
| 51 } | |
| 52 | |
| 47 virtual int GetBrowserWindowID() const { | 53 virtual int GetBrowserWindowID() const { |
| 48 return extension_misc::kUnknownWindowId; | 54 return extension_misc::kUnknownWindowId; |
| 49 } | 55 } |
| 50 virtual void DidNavigate(RenderViewHost* render_view_host, | 56 virtual void DidNavigate(RenderViewHost* render_view_host, |
| 51 const ViewHostMsg_FrameNavigate_Params& params); | 57 const ViewHostMsg_FrameNavigate_Params& params); |
| 52 virtual WebPreferences GetWebkitPrefs(); | 58 virtual WebPreferences GetWebkitPrefs(); |
| 53 virtual void ProcessDOMUIMessage(const std::string& message, | 59 virtual void ProcessDOMUIMessage(const std::string& message, |
| 54 const ListValue* content, | 60 const ListValue* content, |
| 55 const GURL& source_url, | 61 const GURL& source_url, |
| 56 int request_id, | 62 int request_id, |
| 57 bool has_callback); | 63 bool has_callback); |
| 58 virtual void RunJavaScriptMessage(const std::wstring& message, | 64 virtual void RunJavaScriptMessage(const std::wstring& message, |
| 59 const std::wstring& default_prompt, | 65 const std::wstring& default_prompt, |
| 60 const GURL& frame_url, | 66 const GURL& frame_url, |
| 61 const int flags, | 67 const int flags, |
| 62 IPC::Message* reply_msg, | 68 IPC::Message* reply_msg, |
| 63 bool* did_suppress_message); | 69 bool* did_suppress_message); |
| 64 virtual void Close(RenderViewHost* render_view_host); | 70 virtual void Close(RenderViewHost* render_view_host); |
| 65 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; | 71 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; |
| 66 | 72 |
| 67 // RenderViewHostDelegate::View | 73 // RenderViewHostDelegate::View |
| 68 virtual void CreateNewWindow( | 74 virtual void CreateNewWindow( |
| 69 int route_id, | 75 int route_id, |
| 70 WindowContainerType window_container_type); | 76 WindowContainerType window_container_type, |
| 77 const string16& frame_name); | |
| 71 virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); | 78 virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type); |
| 72 virtual void ShowCreatedWindow(int route_id, | 79 virtual void ShowCreatedWindow(int route_id, |
| 73 WindowOpenDisposition disposition, | 80 WindowOpenDisposition disposition, |
| 74 const gfx::Rect& initial_pos, | 81 const gfx::Rect& initial_pos, |
| 75 bool user_gesture); | 82 bool user_gesture); |
| 76 virtual void ShowCreatedWidget(int route_id, | 83 virtual void ShowCreatedWidget(int route_id, |
| 77 const gfx::Rect& initial_pos); | 84 const gfx::Rect& initial_pos); |
| 78 virtual void ShowContextMenu(const ContextMenuParams& params) {} | 85 virtual void ShowContextMenu(const ContextMenuParams& params) {} |
| 79 virtual void StartDragging(const WebDropData& drop_data, | 86 virtual void StartDragging(const WebDropData& drop_data, |
| 80 WebKit::WebDragOperationsMask allowed_operations, | 87 WebKit::WebDragOperationsMask allowed_operations, |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 111 private: | 118 private: |
| 112 // The host for our HTML content. | 119 // The host for our HTML content. |
| 113 RenderViewHost* render_view_host_; | 120 RenderViewHost* render_view_host_; |
| 114 | 121 |
| 115 // Common implementations of some RenderViewHostDelegate::View methods. | 122 // Common implementations of some RenderViewHostDelegate::View methods. |
| 116 RenderViewHostDelegateViewHelper delegate_view_helper_; | 123 RenderViewHostDelegateViewHelper delegate_view_helper_; |
| 117 | 124 |
| 118 // The URL being hosted. | 125 // The URL being hosted. |
| 119 GURL url_; | 126 GURL url_; |
| 120 | 127 |
| 128 // The name of the frame associated with this BC's RenderView (used when | |
|
rafaelw
2010/06/10 22:48:05
frame -> top-level frame
| |
| 129 // restoring BackgroundContents at startup, so they are re-launched with | |
| 130 // the correct name). | |
| 131 string16 frame_name_; | |
| 132 | |
| 121 NotificationRegistrar registrar_; | 133 NotificationRegistrar registrar_; |
| 122 | 134 |
| 123 DISALLOW_COPY_AND_ASSIGN(BackgroundContents); | 135 DISALLOW_COPY_AND_ASSIGN(BackgroundContents); |
| 124 }; | 136 }; |
| 125 | 137 |
| 126 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ | 138 #endif // CHROME_BROWSER_TAB_CONTENTS_BACKGROUND_CONTENTS_H_ |
| OLD | NEW |