| 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 "content/browser/download/save_package.h" | 18 #include "content/browser/download/save_package.h" |
| 19 #include "content/browser/javascript_dialogs.h" | 19 #include "content/browser/javascript_dialogs.h" |
| 20 #include "content/browser/renderer_host/java_bridge_dispatcher_host_manager.h" | 20 #include "content/browser/renderer_host/java_bridge_dispatcher_host_manager.h" |
| 21 #include "content/browser/renderer_host/render_view_host_delegate.h" | 21 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 22 #include "content/browser/tab_contents/navigation_controller.h" | 22 #include "content/browser/tab_contents/navigation_controller.h" |
| 23 #include "content/browser/tab_contents/navigation_entry.h" | 23 #include "content/browser/tab_contents/navigation_entry.h" |
| 24 #include "content/browser/tab_contents/page_navigator.h" | 24 #include "content/browser/tab_contents/page_navigator.h" |
| 25 #include "content/browser/tab_contents/render_view_host_manager.h" | 25 #include "content/browser/tab_contents/render_view_host_manager.h" |
| 26 #include "content/browser/tab_contents/tab_contents_observer.h" | 26 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 27 #include "content/browser/webui/web_ui.h" | 27 #include "content/browser/webui/web_ui.h" |
| 28 #include "content/common/content_export.h" | 28 #include "content/common/content_export.h" |
| 29 #include "content/common/property_bag.h" | 29 #include "content/common/property_bag.h" |
| 30 #include "content/common/renderer_preferences.h" | 30 #include "content/public/common/renderer_preferences.h" |
| 31 #include "net/base/load_states.h" | 31 #include "net/base/load_states.h" |
| 32 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
| 33 #include "webkit/glue/resource_type.h" | 33 #include "webkit/glue/resource_type.h" |
| 34 | 34 |
| 35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 36 #include "base/win/scoped_handle.h" | 36 #include "base/win/scoped_handle.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace gfx { | 39 class DownloadItem; |
| 40 class Rect; | 40 class LoadNotificationDetails; |
| 41 } | 41 class RenderViewHost; |
| 42 class SessionStorageNamespace; |
| 43 class SiteInstance; |
| 44 class TabContentsDelegate; |
| 45 class TabContentsObserver; |
| 46 class TabContentsView; |
| 47 struct ViewHostMsg_DidFailProvisionalLoadWithError_Params; |
| 48 |
| 42 namespace webkit_glue { | 49 namespace webkit_glue { |
| 43 struct WebIntentData; | 50 struct WebIntentData; |
| 44 } | 51 } |
| 45 | 52 |
| 46 class DownloadItem; | |
| 47 class LoadNotificationDetails; | |
| 48 struct RendererPreferences; | |
| 49 class RenderViewHost; | |
| 50 class SessionStorageNamespace; | |
| 51 class SiteInstance; | |
| 52 class SkBitmap; | |
| 53 class TabContentsDelegate; | |
| 54 class TabContentsObserver; | |
| 55 class TabContentsView; | |
| 56 struct ThumbnailScore; | |
| 57 class URLPattern; | |
| 58 struct ViewHostMsg_DidFailProvisionalLoadWithError_Params; | |
| 59 struct ViewHostMsg_FrameNavigate_Params; | |
| 60 struct ViewHostMsg_RunFileChooser_Params; | |
| 61 struct WebPreferences; | |
| 62 class WebUI; | |
| 63 | |
| 64 // Describes what goes in the main content area of a tab. TabContents is | 53 // Describes what goes in the main content area of a tab. TabContents is |
| 65 // the only type of TabContents, and these should be merged together. | 54 // the only type of TabContents, and these should be merged together. |
| 66 class CONTENT_EXPORT TabContents : public PageNavigator, | 55 class CONTENT_EXPORT TabContents : public PageNavigator, |
| 67 public RenderViewHostDelegate, | 56 public RenderViewHostDelegate, |
| 68 public RenderViewHostManager::Delegate, | 57 public RenderViewHostManager::Delegate, |
| 69 public content::JavaScriptDialogDelegate { | 58 public content::JavaScriptDialogDelegate { |
| 70 public: | 59 public: |
| 71 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it | 60 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it |
| 72 // what has changed. Combine them to update more than one thing. | 61 // what has changed. Combine them to update more than one thing. |
| 73 enum InvalidateTypes { | 62 enum InvalidateTypes { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 // ViewMsg_SetPageEncoding to the renderer. |UpdateEncoding| is kinda | 385 // ViewMsg_SetPageEncoding to the renderer. |UpdateEncoding| is kinda |
| 397 // the opposite of this, by which 'browser' is notified of | 386 // the opposite of this, by which 'browser' is notified of |
| 398 // the encoding of the current tab from 'renderer' (determined by | 387 // the encoding of the current tab from 'renderer' (determined by |
| 399 // auto-detect, http header, meta, bom detection, etc). | 388 // auto-detect, http header, meta, bom detection, etc). |
| 400 void SetOverrideEncoding(const std::string& encoding); | 389 void SetOverrideEncoding(const std::string& encoding); |
| 401 | 390 |
| 402 // Remove any user-defined override encoding and reload by sending down | 391 // Remove any user-defined override encoding and reload by sending down |
| 403 // ViewMsg_ResetPageEncodingToDefault to the renderer. | 392 // ViewMsg_ResetPageEncodingToDefault to the renderer. |
| 404 void ResetOverrideEncoding(); | 393 void ResetOverrideEncoding(); |
| 405 | 394 |
| 406 RendererPreferences* GetMutableRendererPrefs() { | 395 content::RendererPreferences* GetMutableRendererPrefs() { |
| 407 return &renderer_preferences_; | 396 return &renderer_preferences_; |
| 408 } | 397 } |
| 409 | 398 |
| 410 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { | 399 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { |
| 411 opener_web_ui_type_ = opener_web_ui_type; | 400 opener_web_ui_type_ = opener_web_ui_type; |
| 412 } | 401 } |
| 413 | 402 |
| 414 // Set the time when we started to create the new tab page. This time is | 403 // Set the time when we started to create the new tab page. This time is |
| 415 // from before we created this TabContents. | 404 // from before we created this TabContents. |
| 416 void set_new_tab_start_time(const base::TimeTicks& time) { | 405 void set_new_tab_start_time(const base::TimeTicks& time) { |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 virtual void RunJavaScriptMessage(const RenderViewHost* rvh, | 652 virtual void RunJavaScriptMessage(const RenderViewHost* rvh, |
| 664 const string16& message, | 653 const string16& message, |
| 665 const string16& default_prompt, | 654 const string16& default_prompt, |
| 666 const GURL& frame_url, | 655 const GURL& frame_url, |
| 667 const int flags, | 656 const int flags, |
| 668 IPC::Message* reply_msg, | 657 IPC::Message* reply_msg, |
| 669 bool* did_suppress_message) OVERRIDE; | 658 bool* did_suppress_message) OVERRIDE; |
| 670 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, | 659 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, |
| 671 const string16& message, | 660 const string16& message, |
| 672 IPC::Message* reply_msg) OVERRIDE; | 661 IPC::Message* reply_msg) OVERRIDE; |
| 673 virtual RendererPreferences GetRendererPrefs( | 662 virtual content::RendererPreferences GetRendererPrefs( |
| 674 content::BrowserContext* browser_context) const OVERRIDE; | 663 content::BrowserContext* browser_context) const OVERRIDE; |
| 675 virtual WebPreferences GetWebkitPrefs() OVERRIDE; | 664 virtual WebPreferences GetWebkitPrefs() OVERRIDE; |
| 676 virtual void OnUserGesture() OVERRIDE; | 665 virtual void OnUserGesture() OVERRIDE; |
| 677 virtual void OnIgnoredUIEvent() OVERRIDE; | 666 virtual void OnIgnoredUIEvent() OVERRIDE; |
| 678 virtual void RendererUnresponsive(RenderViewHost* render_view_host, | 667 virtual void RendererUnresponsive(RenderViewHost* render_view_host, |
| 679 bool is_during_unload) OVERRIDE; | 668 bool is_during_unload) OVERRIDE; |
| 680 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; | 669 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; |
| 681 virtual void LoadStateChanged(const GURL& url, | 670 virtual void LoadStateChanged(const GURL& url, |
| 682 const net::LoadStateWithParam& load_state, | 671 const net::LoadStateWithParam& load_state, |
| 683 uint64 upload_position, | 672 uint64 upload_position, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 // they should pump messages then. | 812 // they should pump messages then. |
| 824 base::win::ScopedHandle message_box_active_; | 813 base::win::ScopedHandle message_box_active_; |
| 825 #endif | 814 #endif |
| 826 | 815 |
| 827 // Set to true when there is an active "before unload" dialog. When true, | 816 // Set to true when there is an active "before unload" dialog. When true, |
| 828 // we've forced the throbber to start in Navigate, and we need to remember to | 817 // we've forced the throbber to start in Navigate, and we need to remember to |
| 829 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. | 818 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. |
| 830 bool is_showing_before_unload_dialog_; | 819 bool is_showing_before_unload_dialog_; |
| 831 | 820 |
| 832 // Settings that get passed to the renderer process. | 821 // Settings that get passed to the renderer process. |
| 833 RendererPreferences renderer_preferences_; | 822 content::RendererPreferences renderer_preferences_; |
| 834 | 823 |
| 835 // If this tab was created from a renderer using window.open, this will be | 824 // If this tab was created from a renderer using window.open, this will be |
| 836 // non-NULL and represent the WebUI of the opening renderer. | 825 // non-NULL and represent the WebUI of the opening renderer. |
| 837 WebUI::TypeID opener_web_ui_type_; | 826 WebUI::TypeID opener_web_ui_type_; |
| 838 | 827 |
| 839 // The time that we started to create the new tab page. | 828 // The time that we started to create the new tab page. |
| 840 base::TimeTicks new_tab_start_time_; | 829 base::TimeTicks new_tab_start_time_; |
| 841 | 830 |
| 842 // The time that we started to close the tab. | 831 // The time that we started to close the tab. |
| 843 base::TimeTicks tab_close_start_time_; | 832 base::TimeTicks tab_close_start_time_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 860 ObserverList<TabContentsObserver> observers_; | 849 ObserverList<TabContentsObserver> observers_; |
| 861 | 850 |
| 862 // Content restrictions, used to disable print/copy etc based on content's | 851 // Content restrictions, used to disable print/copy etc based on content's |
| 863 // (full-page plugins for now only) permissions. | 852 // (full-page plugins for now only) permissions. |
| 864 int content_restrictions_; | 853 int content_restrictions_; |
| 865 | 854 |
| 866 DISALLOW_COPY_AND_ASSIGN(TabContents); | 855 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 867 }; | 856 }; |
| 868 | 857 |
| 869 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 858 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |