| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "app/gfx/native_widget_types.h" | 15 #include "app/gfx/native_widget_types.h" |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/gfx/rect.h" | 17 #include "base/gfx/rect.h" |
| 18 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 20 #include "chrome/browser/cancelable_request.h" | 20 #include "chrome/browser/cancelable_request.h" |
| 21 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 21 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
| 22 #include "chrome/browser/download/save_package.h" | 22 #include "chrome/browser/download/save_package.h" |
| 23 #include "chrome/browser/fav_icon_helper.h" | 23 #include "chrome/browser/fav_icon_helper.h" |
| 24 #include "chrome/browser/find_notification_details.h" | 24 #include "chrome/browser/find_notification_details.h" |
| 25 #include "chrome/browser/jsmessage_box_client.h" |
| 25 #include "chrome/browser/shell_dialogs.h" | 26 #include "chrome/browser/shell_dialogs.h" |
| 26 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 27 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 27 #include "chrome/browser/tab_contents/constrained_window.h" | 28 #include "chrome/browser/tab_contents/constrained_window.h" |
| 28 #include "chrome/browser/tab_contents/infobar_delegate.h" | 29 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 29 #include "chrome/browser/tab_contents/navigation_controller.h" | 30 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 30 #include "chrome/browser/tab_contents/navigation_entry.h" | 31 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 31 #include "chrome/browser/tab_contents/page_navigator.h" | 32 #include "chrome/browser/tab_contents/page_navigator.h" |
| 32 #include "chrome/browser/tab_contents/render_view_host_manager.h" | 33 #include "chrome/browser/tab_contents/render_view_host_manager.h" |
| 33 #include "chrome/common/gears_api.h" | 34 #include "chrome/common/gears_api.h" |
| 34 #include "chrome/common/navigation_types.h" | 35 #include "chrome/common/navigation_types.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 struct ViewHostMsg_DidPrintPage_Params; | 91 struct ViewHostMsg_DidPrintPage_Params; |
| 91 | 92 |
| 92 // Describes what goes in the main content area of a tab. TabContents is | 93 // Describes what goes in the main content area of a tab. TabContents is |
| 93 // the only type of TabContents, and these should be merged together. | 94 // the only type of TabContents, and these should be merged together. |
| 94 class TabContents : public PageNavigator, | 95 class TabContents : public PageNavigator, |
| 95 public NotificationObserver, | 96 public NotificationObserver, |
| 96 public RenderViewHostDelegate, | 97 public RenderViewHostDelegate, |
| 97 public RenderViewHostDelegate::BrowserIntegration, | 98 public RenderViewHostDelegate::BrowserIntegration, |
| 98 public RenderViewHostDelegate::Resource, | 99 public RenderViewHostDelegate::Resource, |
| 99 public RenderViewHostManager::Delegate, | 100 public RenderViewHostManager::Delegate, |
| 100 public SelectFileDialog::Listener { | 101 public SelectFileDialog::Listener, |
| 102 public JavaScriptMessageBoxClient { |
| 101 public: | 103 public: |
| 102 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it | 104 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it |
| 103 // what has changed. Combine them to update more than one thing. | 105 // what has changed. Combine them to update more than one thing. |
| 104 enum InvalidateTypes { | 106 enum InvalidateTypes { |
| 105 INVALIDATE_URL = 1 << 0, // The URL has changed. | 107 INVALIDATE_URL = 1 << 0, // The URL has changed. |
| 106 INVALIDATE_TAB = 1 << 1, // The favicon, or crashed state | 108 INVALIDATE_TAB = 1 << 1, // The favicon, or crashed state |
| 107 // changed. | 109 // changed. |
| 108 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. | 110 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. |
| 109 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. | 111 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. |
| 110 INVALIDATE_BOOKMARK_BAR = 1 << 4, // State of ShouldShowBookmarkBar | 112 INVALIDATE_BOOKMARK_BAR = 1 << 4, // State of ShouldShowBookmarkBar |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 void GetPageLanguage(); | 528 void GetPageLanguage(); |
| 527 | 529 |
| 528 // Misc state & callbacks ---------------------------------------------------- | 530 // Misc state & callbacks ---------------------------------------------------- |
| 529 | 531 |
| 530 // Set whether the contents should block javascript message boxes or not. | 532 // Set whether the contents should block javascript message boxes or not. |
| 531 // Default is not to block any message boxes. | 533 // Default is not to block any message boxes. |
| 532 void set_suppress_javascript_messages(bool suppress_javascript_messages) { | 534 void set_suppress_javascript_messages(bool suppress_javascript_messages) { |
| 533 suppress_javascript_messages_ = suppress_javascript_messages; | 535 suppress_javascript_messages_ = suppress_javascript_messages; |
| 534 } | 536 } |
| 535 | 537 |
| 536 // AppModalDialog calls this when the dialog is closed. | |
| 537 void OnJavaScriptMessageBoxClosed(IPC::Message* reply_msg, | |
| 538 bool success, | |
| 539 const std::wstring& prompt); | |
| 540 | |
| 541 // Prepare for saving the current web page to disk. | 538 // Prepare for saving the current web page to disk. |
| 542 void OnSavePage(); | 539 void OnSavePage(); |
| 543 | 540 |
| 544 // Save page with the main HTML file path, the directory for saving resources, | 541 // Save page with the main HTML file path, the directory for saving resources, |
| 545 // and the save type: HTML only or complete web page. Returns true if the | 542 // and the save type: HTML only or complete web page. Returns true if the |
| 546 // saving process has been initiated successfully. | 543 // saving process has been initiated successfully. |
| 547 bool SavePage(const FilePath& main_file, const FilePath& dir_path, | 544 bool SavePage(const FilePath& main_file, const FilePath& dir_path, |
| 548 SavePackage::SavePackageType save_type); | 545 SavePackage::SavePackageType save_type); |
| 549 | 546 |
| 550 // Displays asynchronously a print preview (generated by the renderer) if not | 547 // Displays asynchronously a print preview (generated by the renderer) if not |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 // InitWithExistingID. | 948 // InitWithExistingID. |
| 952 virtual bool CreateRenderViewForRenderManager( | 949 virtual bool CreateRenderViewForRenderManager( |
| 953 RenderViewHost* render_view_host); | 950 RenderViewHost* render_view_host); |
| 954 | 951 |
| 955 // NotificationObserver ------------------------------------------------------ | 952 // NotificationObserver ------------------------------------------------------ |
| 956 | 953 |
| 957 virtual void Observe(NotificationType type, | 954 virtual void Observe(NotificationType type, |
| 958 const NotificationSource& source, | 955 const NotificationSource& source, |
| 959 const NotificationDetails& details); | 956 const NotificationDetails& details); |
| 960 | 957 |
| 958 |
| 959 // JavaScriptMessageBoxClient ------------------------------------------------ |
| 960 virtual std::wstring GetMessageBoxTitle(const GURL& frame_url, |
| 961 bool is_alert); |
| 962 virtual gfx::NativeWindow GetMessageBoxRootWindow(); |
| 963 virtual void OnMessageBoxClosed(IPC::Message* reply_msg, |
| 964 bool success, |
| 965 const std::wstring& prompt); |
| 966 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes); |
| 967 virtual TabContents* AsTabContents() { return this; } |
| 968 |
| 961 // Data for core operation --------------------------------------------------- | 969 // Data for core operation --------------------------------------------------- |
| 962 | 970 |
| 963 // Delegate for notifying our owner about stuff. Not owned by us. | 971 // Delegate for notifying our owner about stuff. Not owned by us. |
| 964 TabContentsDelegate* delegate_; | 972 TabContentsDelegate* delegate_; |
| 965 | 973 |
| 966 // Handles the back/forward list and loading. | 974 // Handles the back/forward list and loading. |
| 967 NavigationController controller_; | 975 NavigationController controller_; |
| 968 | 976 |
| 969 // The corresponding view. | 977 // The corresponding view. |
| 970 scoped_ptr<TabContentsView> view_; | 978 scoped_ptr<TabContentsView> view_; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 | 1170 |
| 1163 // The time that we started to close the tab. | 1171 // The time that we started to close the tab. |
| 1164 base::TimeTicks tab_close_start_time_; | 1172 base::TimeTicks tab_close_start_time_; |
| 1165 | 1173 |
| 1166 // --------------------------------------------------------------------------- | 1174 // --------------------------------------------------------------------------- |
| 1167 | 1175 |
| 1168 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1176 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 1169 }; | 1177 }; |
| 1170 | 1178 |
| 1171 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1179 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |