| 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_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "content/browser/download/save_package.h" | 19 #include "content/browser/download/save_package.h" |
| 19 #include "content/browser/javascript_dialogs.h" | 20 #include "content/browser/javascript_dialogs.h" |
| 20 #include "content/browser/renderer_host/render_view_host_delegate.h" | 21 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 21 #include "content/browser/tab_contents/constrained_window.h" | 22 #include "content/browser/tab_contents/constrained_window.h" |
| 22 #include "content/browser/tab_contents/navigation_controller.h" | 23 #include "content/browser/tab_contents/navigation_controller.h" |
| 23 #include "content/browser/tab_contents/navigation_entry.h" | 24 #include "content/browser/tab_contents/navigation_entry.h" |
| 24 #include "content/browser/tab_contents/page_navigator.h" | 25 #include "content/browser/tab_contents/page_navigator.h" |
| 25 #include "content/browser/tab_contents/render_view_host_manager.h" | 26 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 26 #include "content/browser/tab_contents/tab_contents_observer.h" | 27 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 27 #include "content/browser/webui/web_ui.h" | 28 #include "content/browser/webui/web_ui.h" |
| 28 #include "content/common/property_bag.h" | 29 #include "content/common/property_bag.h" |
| 29 #include "content/common/renderer_preferences.h" | 30 #include "content/common/renderer_preferences.h" |
| 30 #include "net/base/load_states.h" | 31 #include "net/base/load_states.h" |
| 31 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
| 32 | 33 |
| 33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 34 #include "base/win/scoped_handle.h" | 35 #include "base/win/scoped_handle.h" |
| 35 #endif | 36 #endif |
| 36 | 37 |
| 37 namespace gfx { | 38 namespace gfx { |
| 38 class Rect; | 39 class Rect; |
| 39 } | 40 } |
| 40 | 41 |
| 41 class DownloadItem; | 42 class DownloadItem; |
| 42 class LoadNotificationDetails; | 43 class LoadNotificationDetails; |
| 43 class Profile; | |
| 44 struct RendererPreferences; | 44 struct RendererPreferences; |
| 45 class RenderViewHost; | 45 class RenderViewHost; |
| 46 class SessionStorageNamespace; | 46 class SessionStorageNamespace; |
| 47 class SiteInstance; | 47 class SiteInstance; |
| 48 class SkBitmap; | 48 class SkBitmap; |
| 49 class TabContentsDelegate; | 49 class TabContentsDelegate; |
| 50 class TabContentsObserver; | 50 class TabContentsObserver; |
| 51 class TabContentsView; | 51 class TabContentsView; |
| 52 struct ThumbnailScore; | 52 struct ThumbnailScore; |
| 53 class URLPattern; | 53 class URLPattern; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 INVALIDATE_TITLE = 1 << 4, // The title changed. | 73 INVALIDATE_TITLE = 1 << 4, // The title changed. |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // |base_tab_contents| is used if we want to size the new tab contents view | 76 // |base_tab_contents| is used if we want to size the new tab contents view |
| 77 // based on an existing tab contents view. This can be NULL if not needed. | 77 // based on an existing tab contents view. This can be NULL if not needed. |
| 78 // | 78 // |
| 79 // The session storage namespace parameter allows multiple render views and | 79 // The session storage namespace parameter allows multiple render views and |
| 80 // tab contentses to share the same session storage (part of the WebStorage | 80 // tab contentses to share the same session storage (part of the WebStorage |
| 81 // spec) space. This is useful when restoring tabs, but most callers should | 81 // spec) space. This is useful when restoring tabs, but most callers should |
| 82 // pass in NULL which will cause a new SessionStorageNamespace to be created. | 82 // pass in NULL which will cause a new SessionStorageNamespace to be created. |
| 83 TabContents(Profile* profile, | 83 TabContents(content::BrowserContext* browser_context, |
| 84 SiteInstance* site_instance, | 84 SiteInstance* site_instance, |
| 85 int routing_id, | 85 int routing_id, |
| 86 const TabContents* base_tab_contents, | 86 const TabContents* base_tab_contents, |
| 87 SessionStorageNamespace* session_storage_namespace); | 87 SessionStorageNamespace* session_storage_namespace); |
| 88 virtual ~TabContents(); | 88 virtual ~TabContents(); |
| 89 | 89 |
| 90 // Intrinsic tab state ------------------------------------------------------- | 90 // Intrinsic tab state ------------------------------------------------------- |
| 91 | 91 |
| 92 // Returns the property bag for this tab contents, where callers can add | 92 // Returns the property bag for this tab contents, where callers can add |
| 93 // extra data they may wish to associate with the tab. Returns a pointer | 93 // extra data they may wish to associate with the tab. Returns a pointer |
| 94 // rather than a reference since the PropertyAccessors expect this. | 94 // rather than a reference since the PropertyAccessors expect this. |
| 95 const PropertyBag* property_bag() const { return &property_bag_; } | 95 const PropertyBag* property_bag() const { return &property_bag_; } |
| 96 PropertyBag* property_bag() { return &property_bag_; } | 96 PropertyBag* property_bag() { return &property_bag_; } |
| 97 | 97 |
| 98 TabContentsDelegate* delegate() const { return delegate_; } | 98 TabContentsDelegate* delegate() const { return delegate_; } |
| 99 void set_delegate(TabContentsDelegate* delegate); | 99 void set_delegate(TabContentsDelegate* delegate); |
| 100 | 100 |
| 101 // Gets the controller for this tab contents. | 101 // Gets the controller for this tab contents. |
| 102 NavigationController& controller() { return controller_; } | 102 NavigationController& controller() { return controller_; } |
| 103 const NavigationController& controller() const { return controller_; } | 103 const NavigationController& controller() const { return controller_; } |
| 104 | 104 |
| 105 // Returns the user profile associated with this TabContents (via the | 105 // Returns the user browser context associated with this TabContents (via the |
| 106 // NavigationController). | 106 // NavigationController). |
| 107 Profile* profile() const { return controller_.profile(); } | 107 content::BrowserContext* browser_context() const { |
| 108 return controller_.browser_context(); |
| 109 } |
| 110 |
| 111 // Returns the profile. |
| 112 // TEMPORARY; http://crbug.com/76788 |
| 113 Profile* profile() const { |
| 114 return Profile::FromBrowserContext(browser_context()); |
| 115 } |
| 108 | 116 |
| 109 // Returns the SavePackage which manages the page saving job. May be NULL. | 117 // Returns the SavePackage which manages the page saving job. May be NULL. |
| 110 SavePackage* save_package() const { return save_package_.get(); } | 118 SavePackage* save_package() const { return save_package_.get(); } |
| 111 | 119 |
| 112 // Return the currently active RenderProcessHost and RenderViewHost. Each of | 120 // Return the currently active RenderProcessHost and RenderViewHost. Each of |
| 113 // these may change over time. | 121 // these may change over time. |
| 114 RenderProcessHost* GetRenderProcessHost() const; | 122 RenderProcessHost* GetRenderProcessHost() const; |
| 115 RenderViewHost* render_view_host() const { | 123 RenderViewHost* render_view_host() const { |
| 116 return render_manager_.current_host(); | 124 return render_manager_.current_host(); |
| 117 } | 125 } |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 virtual void RunJavaScriptMessage(const RenderViewHost* rvh, | 665 virtual void RunJavaScriptMessage(const RenderViewHost* rvh, |
| 658 const string16& message, | 666 const string16& message, |
| 659 const string16& default_prompt, | 667 const string16& default_prompt, |
| 660 const GURL& frame_url, | 668 const GURL& frame_url, |
| 661 const int flags, | 669 const int flags, |
| 662 IPC::Message* reply_msg, | 670 IPC::Message* reply_msg, |
| 663 bool* did_suppress_message) OVERRIDE; | 671 bool* did_suppress_message) OVERRIDE; |
| 664 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, | 672 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, |
| 665 const string16& message, | 673 const string16& message, |
| 666 IPC::Message* reply_msg) OVERRIDE; | 674 IPC::Message* reply_msg) OVERRIDE; |
| 667 virtual RendererPreferences GetRendererPrefs(Profile* profile) const OVERRIDE; | 675 virtual RendererPreferences GetRendererPrefs( |
| 676 content::BrowserContext* browser_context) const OVERRIDE; |
| 668 virtual WebPreferences GetWebkitPrefs() OVERRIDE; | 677 virtual WebPreferences GetWebkitPrefs() OVERRIDE; |
| 669 virtual void OnUserGesture() OVERRIDE; | 678 virtual void OnUserGesture() OVERRIDE; |
| 670 virtual void OnIgnoredUIEvent() OVERRIDE; | 679 virtual void OnIgnoredUIEvent() OVERRIDE; |
| 671 virtual void RendererUnresponsive(RenderViewHost* render_view_host, | 680 virtual void RendererUnresponsive(RenderViewHost* render_view_host, |
| 672 bool is_during_unload) OVERRIDE; | 681 bool is_during_unload) OVERRIDE; |
| 673 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; | 682 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; |
| 674 virtual void LoadStateChanged(const GURL& url, | 683 virtual void LoadStateChanged(const GURL& url, |
| 675 net::LoadState load_state, | 684 net::LoadState load_state, |
| 676 uint64 upload_position, | 685 uint64 upload_position, |
| 677 uint64 upload_size) OVERRIDE; | 686 uint64 upload_size) OVERRIDE; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 ObserverList<TabContentsObserver> observers_; | 852 ObserverList<TabContentsObserver> observers_; |
| 844 | 853 |
| 845 // Content restrictions, used to disable print/copy etc based on content's | 854 // Content restrictions, used to disable print/copy etc based on content's |
| 846 // (full-page plugins for now only) permissions. | 855 // (full-page plugins for now only) permissions. |
| 847 int content_restrictions_; | 856 int content_restrictions_; |
| 848 | 857 |
| 849 DISALLOW_COPY_AND_ASSIGN(TabContents); | 858 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 850 }; | 859 }; |
| 851 | 860 |
| 852 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 861 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |