| 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_TAB_CONTENTS_H_ |     5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 
|     6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |     6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 
|     7 #pragma once |     7 #pragma once | 
|     8  |     8  | 
|     9 #include "build/build_config.h" |     9 #include "build/build_config.h" | 
|    10  |    10  | 
|    11 #include <deque> |    11 #include <deque> | 
|    12 #include <map> |    12 #include <map> | 
|    13 #include <string> |    13 #include <string> | 
|    14 #include <vector> |    14 #include <vector> | 
|    15  |    15  | 
|    16 #include "base/basictypes.h" |    16 #include "base/basictypes.h" | 
|    17 #include "base/gtest_prod_util.h" |    17 #include "base/gtest_prod_util.h" | 
|    18 #include "base/scoped_ptr.h" |    18 #include "base/scoped_ptr.h" | 
|    19 #include "chrome/browser/cancelable_request.h" |    19 #include "chrome/browser/cancelable_request.h" | 
|    20 #include "chrome/browser/dom_ui/dom_ui_factory.h" |    20 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 
|    21 #include "chrome/browser/download/save_package.h" |    21 #include "chrome/browser/download/save_package.h" | 
|    22 #include "chrome/browser/extensions/image_loading_tracker.h" |    22 #include "chrome/browser/extensions/image_loading_tracker.h" | 
|    23 #include "chrome/browser/fav_icon_helper.h" |    23 #include "chrome/browser/fav_icon_helper.h" | 
|    24 #include "chrome/browser/find_bar_controller.h" |    24 #include "chrome/browser/find_bar_controller.h" | 
|    25 #include "chrome/browser/find_notification_details.h" |    25 #include "chrome/browser/find_notification_details.h" | 
|    26 #include "chrome/browser/js_modal_dialog.h" |    26 #include "chrome/browser/js_modal_dialog.h" | 
|    27 #include "chrome/browser/prefs/pref_change_registrar.h" |    27 #include "chrome/browser/prefs/pref_change_registrar.h" | 
|    28 #include "chrome/browser/password_manager/password_manager_delegate.h" |  | 
|    29 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |    28 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 
|    30 #include "chrome/browser/tab_contents/constrained_window.h" |    29 #include "chrome/browser/tab_contents/constrained_window.h" | 
|    31 #include "chrome/browser/tab_contents/language_state.h" |    30 #include "chrome/browser/tab_contents/language_state.h" | 
|    32 #include "chrome/browser/tab_contents/navigation_controller.h" |    31 #include "chrome/browser/tab_contents/navigation_controller.h" | 
|    33 #include "chrome/browser/tab_contents/navigation_entry.h" |    32 #include "chrome/browser/tab_contents/navigation_entry.h" | 
|    34 #include "chrome/browser/tab_contents/page_navigator.h" |    33 #include "chrome/browser/tab_contents/page_navigator.h" | 
|    35 #include "chrome/browser/tab_contents/render_view_host_manager.h" |    34 #include "chrome/browser/tab_contents/render_view_host_manager.h" | 
|    36 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" |    35 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" | 
|    37 #include "chrome/common/notification_registrar.h" |    36 #include "chrome/common/notification_registrar.h" | 
|    38 #include "chrome/common/property_bag.h" |    37 #include "chrome/common/property_bag.h" | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|    65 class AutocompleteHistoryManager; |    64 class AutocompleteHistoryManager; | 
|    66 class AutoFillManager; |    65 class AutoFillManager; | 
|    67 class BlockedContentContainer; |    66 class BlockedContentContainer; | 
|    68 class DOMUI; |    67 class DOMUI; | 
|    69 class DownloadItem; |    68 class DownloadItem; | 
|    70 class Extension; |    69 class Extension; | 
|    71 class FileSelectHelper; |    70 class FileSelectHelper; | 
|    72 class InfoBarDelegate; |    71 class InfoBarDelegate; | 
|    73 class LoadNotificationDetails; |    72 class LoadNotificationDetails; | 
|    74 class OmniboxSearchHint; |    73 class OmniboxSearchHint; | 
|    75 class PasswordManager; |  | 
|    76 class PluginInstaller; |    74 class PluginInstaller; | 
|    77 class Profile; |    75 class Profile; | 
|    78 struct RendererPreferences; |    76 struct RendererPreferences; | 
|    79 class RenderViewHost; |    77 class RenderViewHost; | 
|    80 class SessionStorageNamespace; |    78 class SessionStorageNamespace; | 
|    81 class SiteInstance; |    79 class SiteInstance; | 
|    82 class SkBitmap; |    80 class SkBitmap; | 
|    83 class TabContents; |    81 class TabContents; | 
|    84 class TabContentsDelegate; |    82 class TabContentsDelegate; | 
|    85 class TabContentsSSLHelper; |    83 class TabContentsSSLHelper; | 
|    86 class TabContentsView; |    84 class TabContentsView; | 
|    87 class URLPattern; |    85 class URLPattern; | 
|    88 struct ThumbnailScore; |    86 struct ThumbnailScore; | 
|    89 struct ViewHostMsg_DomMessage_Params; |    87 struct ViewHostMsg_DomMessage_Params; | 
|    90 struct ViewHostMsg_FrameNavigate_Params; |    88 struct ViewHostMsg_FrameNavigate_Params; | 
 |    89 class WebNavigationObserver; | 
|    91 struct WebPreferences; |    90 struct WebPreferences; | 
|    92  |    91  | 
|    93 // Describes what goes in the main content area of a tab. TabContents is |    92 // Describes what goes in the main content area of a tab. TabContents is | 
|    94 // the only type of TabContents, and these should be merged together. |    93 // the only type of TabContents, and these should be merged together. | 
|    95 class TabContents : public PageNavigator, |    94 class TabContents : public PageNavigator, | 
|    96                     public NotificationObserver, |    95                     public NotificationObserver, | 
|    97                     public RenderViewHostDelegate, |    96                     public RenderViewHostDelegate, | 
|    98                     public RenderViewHostDelegate::BrowserIntegration, |    97                     public RenderViewHostDelegate::BrowserIntegration, | 
|    99                     public RenderViewHostDelegate::Resource, |    98                     public RenderViewHostDelegate::Resource, | 
|   100                     public RenderViewHostManager::Delegate, |    99                     public RenderViewHostManager::Delegate, | 
|   101                     public JavaScriptAppModalDialogDelegate, |   100                     public JavaScriptAppModalDialogDelegate, | 
|   102                     public ImageLoadingTracker::Observer, |   101                     public ImageLoadingTracker::Observer, | 
|   103                     public PasswordManagerDelegate, |  | 
|   104                     public TabSpecificContentSettings::Delegate { |   102                     public TabSpecificContentSettings::Delegate { | 
|   105  public: |   103  public: | 
|   106   // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it |   104   // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it | 
|   107   // what has changed. Combine them to update more than one thing. |   105   // what has changed. Combine them to update more than one thing. | 
|   108   enum InvalidateTypes { |   106   enum InvalidateTypes { | 
|   109     INVALIDATE_URL             = 1 << 0,  // The URL has changed. |   107     INVALIDATE_URL             = 1 << 0,  // The URL has changed. | 
|   110     INVALIDATE_TAB             = 1 << 1,  // The favicon, app icon, or crashed |   108     INVALIDATE_TAB             = 1 << 1,  // The favicon, app icon, or crashed | 
|   111                                           // state changed. |   109                                           // state changed. | 
|   112     INVALIDATE_LOAD            = 1 << 2,  // The loading state has changed. |   110     INVALIDATE_LOAD            = 1 << 2,  // The loading state has changed. | 
|   113     INVALIDATE_PAGE_ACTIONS    = 1 << 3,  // Page action icons have changed. |   111     INVALIDATE_PAGE_ACTIONS    = 1 << 3,  // Page action icons have changed. | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   150   // Returns the user profile associated with this TabContents (via the |   148   // Returns the user profile associated with this TabContents (via the | 
|   151   // NavigationController). |   149   // NavigationController). | 
|   152   Profile* profile() const { return controller_.profile(); } |   150   Profile* profile() const { return controller_.profile(); } | 
|   153  |   151  | 
|   154   // Returns true if contains content rendered by an extension. |   152   // Returns true if contains content rendered by an extension. | 
|   155   bool HostsExtension() const; |   153   bool HostsExtension() const; | 
|   156  |   154  | 
|   157   // Returns the AutoFillManager, creating it if necessary. |   155   // Returns the AutoFillManager, creating it if necessary. | 
|   158   AutoFillManager* GetAutoFillManager(); |   156   AutoFillManager* GetAutoFillManager(); | 
|   159  |   157  | 
|   160   // Returns the PasswordManager, creating it if necessary. |  | 
|   161   PasswordManager* GetPasswordManager(); |  | 
|   162  |  | 
|   163   // Returns the PluginInstaller, creating it if necessary. |   158   // Returns the PluginInstaller, creating it if necessary. | 
|   164   PluginInstaller* GetPluginInstaller(); |   159   PluginInstaller* GetPluginInstaller(); | 
|   165  |   160  | 
|   166   // Returns the TabContentsSSLHelper, creating it if necessary. |   161   // Returns the TabContentsSSLHelper, creating it if necessary. | 
|   167   TabContentsSSLHelper* GetSSLHelper(); |   162   TabContentsSSLHelper* GetSSLHelper(); | 
|   168  |   163  | 
|   169   // Returns the SavePackage which manages the page saving job. May be NULL. |   164   // Returns the SavePackage which manages the page saving job. May be NULL. | 
|   170   SavePackage* save_package() const { return save_package_.get(); } |   165   SavePackage* save_package() const { return save_package_.get(); } | 
|   171  |   166  | 
|   172   // Return the currently active RenderProcessHost and RenderViewHost. Each of |   167   // Return the currently active RenderProcessHost and RenderViewHost. Each of | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   262   // Returns true if we are not using the default favicon. |   257   // Returns true if we are not using the default favicon. | 
|   263   bool FavIconIsValid() const; |   258   bool FavIconIsValid() const; | 
|   264  |   259  | 
|   265   // Returns whether the favicon should be displayed. If this returns false, no |   260   // Returns whether the favicon should be displayed. If this returns false, no | 
|   266   // space is provided for the favicon, and the favicon is never displayed. |   261   // space is provided for the favicon, and the favicon is never displayed. | 
|   267   virtual bool ShouldDisplayFavIcon(); |   262   virtual bool ShouldDisplayFavIcon(); | 
|   268  |   263  | 
|   269   // Returns a human-readable description the tab's loading state. |   264   // Returns a human-readable description the tab's loading state. | 
|   270   virtual std::wstring GetStatusText() const; |   265   virtual std::wstring GetStatusText() const; | 
|   271  |   266  | 
 |   267   // Add and remove observers for page navigation notifications. Adding or | 
 |   268   // removing multiple times has no effect. The order in which notifications | 
 |   269   // are sent to observers is undefined. Clients must be sure to remove the | 
 |   270   // observer before they go away. | 
 |   271   void AddNavigationObserver(WebNavigationObserver* observer); | 
 |   272   void RemoveNavigationObserver(WebNavigationObserver* observer); | 
 |   273  | 
|   272   // Return whether this tab contents is loading a resource. |   274   // Return whether this tab contents is loading a resource. | 
|   273   bool is_loading() const { return is_loading_; } |   275   bool is_loading() const { return is_loading_; } | 
|   274  |   276  | 
|   275   // Returns whether this tab contents is waiting for a first-response for the |   277   // Returns whether this tab contents is waiting for a first-response for the | 
|   276   // main resource of the page. This controls whether the throbber state is |   278   // main resource of the page. This controls whether the throbber state is | 
|   277   // "waiting" or "loading." |   279   // "waiting" or "loading." | 
|   278   bool waiting_for_response() const { return waiting_for_response_; } |   280   bool waiting_for_response() const { return waiting_for_response_; } | 
|   279  |   281  | 
|   280   bool is_starred() const { return is_starred_; } |   282   bool is_starred() const { return is_starred_; } | 
|   281  |   283  | 
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   688   // It is up to callers to call SetBookmarkDragDelegate(NULL) when |   690   // It is up to callers to call SetBookmarkDragDelegate(NULL) when | 
|   689   // |bookmark_drag| is deleted since this class does not take ownership of |   691   // |bookmark_drag| is deleted since this class does not take ownership of | 
|   690   // |bookmark_drag|. |   692   // |bookmark_drag|. | 
|   691   virtual void SetBookmarkDragDelegate( |   693   virtual void SetBookmarkDragDelegate( | 
|   692       RenderViewHostDelegate::BookmarkDrag* bookmark_drag); |   694       RenderViewHostDelegate::BookmarkDrag* bookmark_drag); | 
|   693  |   695  | 
|   694   // The TabSpecificContentSettings object is used to query the blocked content |   696   // The TabSpecificContentSettings object is used to query the blocked content | 
|   695   // state by various UI elements. |   697   // state by various UI elements. | 
|   696   TabSpecificContentSettings* GetTabSpecificContentSettings() const; |   698   TabSpecificContentSettings* GetTabSpecificContentSettings() const; | 
|   697  |   699  | 
|   698   // PasswordManagerDelegate implementation. |  | 
|   699   virtual void FillPasswordForm( |  | 
|   700       const webkit_glue::PasswordFormFillData& form_data); |  | 
|   701   virtual void AddSavePasswordInfoBar(PasswordFormManager* form_to_save); |  | 
|   702   virtual Profile* GetProfileForPasswordManager(); |  | 
|   703   virtual bool DidLastPageLoadEncounterSSLErrors(); |  | 
|   704  |  | 
|   705   // Updates history with the specified navigation. This is called by |   700   // Updates history with the specified navigation. This is called by | 
|   706   // OnMsgNavigate to update history state. |   701   // OnMsgNavigate to update history state. | 
|   707   void UpdateHistoryForNavigation( |   702   void UpdateHistoryForNavigation( | 
|   708       scoped_refptr<history::HistoryAddPageArgs> add_page_args); |   703       scoped_refptr<history::HistoryAddPageArgs> add_page_args); | 
|   709  |   704  | 
|   710   // Sends the page title to the history service. This is called when we receive |   705   // Sends the page title to the history service. This is called when we receive | 
|   711   // the page title and we know we want to update history. |   706   // the page title and we know we want to update history. | 
|   712   void UpdateHistoryPageTitle(const NavigationEntry& entry); |   707   void UpdateHistoryPageTitle(const NavigationEntry& entry); | 
|   713  |   708  | 
|   714   // Gets the zoom level for this tab. |   709   // Gets the zoom level for this tab. | 
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   975                                     const std::wstring& default_prompt, |   970                                     const std::wstring& default_prompt, | 
|   976                                     const GURL& frame_url, |   971                                     const GURL& frame_url, | 
|   977                                     const int flags, |   972                                     const int flags, | 
|   978                                     IPC::Message* reply_msg, |   973                                     IPC::Message* reply_msg, | 
|   979                                     bool* did_suppress_message); |   974                                     bool* did_suppress_message); | 
|   980   virtual void RunBeforeUnloadConfirm(const std::wstring& message, |   975   virtual void RunBeforeUnloadConfirm(const std::wstring& message, | 
|   981                                       IPC::Message* reply_msg); |   976                                       IPC::Message* reply_msg); | 
|   982   virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, |   977   virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, | 
|   983                                    const std::string& json_arguments, |   978                                    const std::string& json_arguments, | 
|   984                                    IPC::Message* reply_msg); |   979                                    IPC::Message* reply_msg); | 
|   985   virtual void PasswordFormsFound( |  | 
|   986       const std::vector<webkit_glue::PasswordForm>& forms); |  | 
|   987   virtual void PasswordFormsVisible( |  | 
|   988       const std::vector<webkit_glue::PasswordForm>& visible_forms); |  | 
|   989   virtual void PageHasOSDD(RenderViewHost* render_view_host, |   980   virtual void PageHasOSDD(RenderViewHost* render_view_host, | 
|   990                            int32 page_id, |   981                            int32 page_id, | 
|   991                            const GURL& url, |   982                            const GURL& url, | 
|   992                            const ViewHostMsg_PageHasOSDD_Type& provider_type); |   983                            const ViewHostMsg_PageHasOSDD_Type& provider_type); | 
|   993   virtual GURL GetAlternateErrorPageURL() const; |   984   virtual GURL GetAlternateErrorPageURL() const; | 
|   994   virtual RendererPreferences GetRendererPrefs(Profile* profile) const; |   985   virtual RendererPreferences GetRendererPrefs(Profile* profile) const; | 
|   995   virtual WebPreferences GetWebkitPrefs(); |   986   virtual WebPreferences GetWebkitPrefs(); | 
|   996   virtual void OnIgnoredUIEvent(); |   987   virtual void OnIgnoredUIEvent(); | 
|   997   virtual void OnJSOutOfMemory(); |   988   virtual void OnJSOutOfMemory(); | 
|   998   virtual void OnCrossSiteResponse(int new_render_process_host_id, |   989   virtual void OnCrossSiteResponse(int new_render_process_host_id, | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1088  |  1079  | 
|  1089   // SavePackage, lazily created. |  1080   // SavePackage, lazily created. | 
|  1090   scoped_refptr<SavePackage> save_package_; |  1081   scoped_refptr<SavePackage> save_package_; | 
|  1091  |  1082  | 
|  1092   // AutocompleteHistoryManager, lazily created. |  1083   // AutocompleteHistoryManager, lazily created. | 
|  1093   scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; |  1084   scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; | 
|  1094  |  1085  | 
|  1095   // AutoFillManager, lazily created. |  1086   // AutoFillManager, lazily created. | 
|  1096   scoped_ptr<AutoFillManager> autofill_manager_; |  1087   scoped_ptr<AutoFillManager> autofill_manager_; | 
|  1097  |  1088  | 
|  1098   // PasswordManager, lazily created. |  | 
|  1099   scoped_ptr<PasswordManager> password_manager_; |  | 
|  1100  |  | 
|  1101   // PluginInstaller, lazily created. |  1089   // PluginInstaller, lazily created. | 
|  1102   scoped_ptr<PluginInstaller> plugin_installer_; |  1090   scoped_ptr<PluginInstaller> plugin_installer_; | 
|  1103  |  1091  | 
|  1104   // TabContentsSSLHelper, lazily created. |  1092   // TabContentsSSLHelper, lazily created. | 
|  1105   scoped_ptr<TabContentsSSLHelper> ssl_helper_; |  1093   scoped_ptr<TabContentsSSLHelper> ssl_helper_; | 
|  1106  |  1094  | 
|  1107   // FileSelectHelper, lazily created. |  1095   // FileSelectHelper, lazily created. | 
|  1108   scoped_ptr<FileSelectHelper> file_select_helper_; |  1096   scoped_ptr<FileSelectHelper> file_select_helper_; | 
|  1109  |  1097  | 
|  1110   // Handles drag and drop event forwarding to extensions. |  1098   // Handles drag and drop event forwarding to extensions. | 
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1297   bool closed_by_user_gesture_; |  1285   bool closed_by_user_gesture_; | 
|  1298  |  1286  | 
|  1299   // Minimum/maximum zoom percent. |  1287   // Minimum/maximum zoom percent. | 
|  1300   int minimum_zoom_percent_; |  1288   int minimum_zoom_percent_; | 
|  1301   int maximum_zoom_percent_; |  1289   int maximum_zoom_percent_; | 
|  1302   // If true, the default zoom limits have been overriden for this tab, in which |  1290   // If true, the default zoom limits have been overriden for this tab, in which | 
|  1303   // case we don't want saved settings to apply to it and we don't want to |  1291   // case we don't want saved settings to apply to it and we don't want to | 
|  1304   // remember it. |  1292   // remember it. | 
|  1305   bool temporary_zoom_settings_; |  1293   bool temporary_zoom_settings_; | 
|  1306  |  1294  | 
 |  1295   // A list of observers notified when page state changes. Weak references. | 
 |  1296   ObserverList<WebNavigationObserver> web_navigation_observers_; | 
 |  1297  | 
|  1307   // Content restrictions, used to disable print/copy etc based on content's |  1298   // Content restrictions, used to disable print/copy etc based on content's | 
|  1308   // (full-page plugins for now only) permissions. |  1299   // (full-page plugins for now only) permissions. | 
|  1309   int content_restrictions_; |  1300   int content_restrictions_; | 
|  1310  |  1301  | 
|  1311   // --------------------------------------------------------------------------- |  1302   // --------------------------------------------------------------------------- | 
|  1312  |  1303  | 
|  1313   DISALLOW_COPY_AND_ASSIGN(TabContents); |  1304   DISALLOW_COPY_AND_ASSIGN(TabContents); | 
|  1314 }; |  1305 }; | 
|  1315  |  1306  | 
|  1316 #endif  // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |  1307 #endif  // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 
| OLD | NEW |