| 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* 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 context associated with this TabContents (via the |
| 106 // NavigationController). | 106 // NavigationController). |
| 107 Profile* profile() const { return controller_.profile(); } | 107 content::BrowserContext* context() const { return controller_.context(); } |
| 108 |
| 109 // Returns the profile. |
| 110 // TEMPORARY; http://crbug.com/76788 |
| 111 Profile* profile() const { return static_cast<Profile*>(context()); } |
| 108 | 112 |
| 109 // Returns the SavePackage which manages the page saving job. May be NULL. | 113 // Returns the SavePackage which manages the page saving job. May be NULL. |
| 110 SavePackage* save_package() const { return save_package_.get(); } | 114 SavePackage* save_package() const { return save_package_.get(); } |
| 111 | 115 |
| 112 // Return the currently active RenderProcessHost and RenderViewHost. Each of | 116 // Return the currently active RenderProcessHost and RenderViewHost. Each of |
| 113 // these may change over time. | 117 // these may change over time. |
| 114 RenderProcessHost* GetRenderProcessHost() const; | 118 RenderProcessHost* GetRenderProcessHost() const; |
| 115 RenderViewHost* render_view_host() const { | 119 RenderViewHost* render_view_host() const { |
| 116 return render_manager_.current_host(); | 120 return render_manager_.current_host(); |
| 117 } | 121 } |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 virtual void RunJavaScriptMessage(const RenderViewHost* rvh, | 658 virtual void RunJavaScriptMessage(const RenderViewHost* rvh, |
| 655 const string16& message, | 659 const string16& message, |
| 656 const string16& default_prompt, | 660 const string16& default_prompt, |
| 657 const GURL& frame_url, | 661 const GURL& frame_url, |
| 658 const int flags, | 662 const int flags, |
| 659 IPC::Message* reply_msg, | 663 IPC::Message* reply_msg, |
| 660 bool* did_suppress_message) OVERRIDE; | 664 bool* did_suppress_message) OVERRIDE; |
| 661 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, | 665 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, |
| 662 const string16& message, | 666 const string16& message, |
| 663 IPC::Message* reply_msg); | 667 IPC::Message* reply_msg); |
| 664 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; | 668 virtual RendererPreferences GetRendererPrefs( |
| 669 content::BrowserContext* context) const OVERRIDE; |
| 665 virtual WebPreferences GetWebkitPrefs(); | 670 virtual WebPreferences GetWebkitPrefs(); |
| 666 virtual void OnUserGesture(); | 671 virtual void OnUserGesture(); |
| 667 virtual void OnIgnoredUIEvent(); | 672 virtual void OnIgnoredUIEvent(); |
| 668 virtual void OnCrossSiteResponse(int new_render_process_host_id, | 673 virtual void OnCrossSiteResponse(int new_render_process_host_id, |
| 669 int new_request_id); | 674 int new_request_id); |
| 670 virtual void RendererUnresponsive(RenderViewHost* render_view_host, | 675 virtual void RendererUnresponsive(RenderViewHost* render_view_host, |
| 671 bool is_during_unload); | 676 bool is_during_unload); |
| 672 virtual void RendererResponsive(RenderViewHost* render_view_host); | 677 virtual void RendererResponsive(RenderViewHost* render_view_host); |
| 673 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state, | 678 virtual void LoadStateChanged(const GURL& url, net::LoadState load_state, |
| 674 uint64 upload_position, uint64 upload_size); | 679 uint64 upload_position, uint64 upload_size); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 ObserverList<TabContentsObserver> observers_; | 844 ObserverList<TabContentsObserver> observers_; |
| 840 | 845 |
| 841 // Content restrictions, used to disable print/copy etc based on content's | 846 // Content restrictions, used to disable print/copy etc based on content's |
| 842 // (full-page plugins for now only) permissions. | 847 // (full-page plugins for now only) permissions. |
| 843 int content_restrictions_; | 848 int content_restrictions_; |
| 844 | 849 |
| 845 DISALLOW_COPY_AND_ASSIGN(TabContents); | 850 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 846 }; | 851 }; |
| 847 | 852 |
| 848 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 853 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |