| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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/shell_dialogs.h" | 25 #include "chrome/browser/shell_dialogs.h" |
| 26 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 26 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 27 #include "chrome/browser/tab_contents/constrained_window.h" | 27 #include "chrome/browser/tab_contents/constrained_window.h" |
| 28 #include "chrome/browser/tab_contents/infobar_delegate.h" | 28 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| 29 #include "chrome/browser/tab_contents/navigation_controller.h" | 29 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 30 #include "chrome/browser/tab_contents/navigation_entry.h" | 30 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 31 #include "chrome/browser/tab_contents/page_navigator.h" | 31 #include "chrome/browser/tab_contents/page_navigator.h" |
| 32 #include "chrome/browser/tab_contents/render_view_host_manager.h" | 32 #include "chrome/browser/tab_contents/render_view_host_manager.h" |
| 33 #include "chrome/common/extensions/extension_action.h" | |
| 34 #include "chrome/common/gears_api.h" | 33 #include "chrome/common/gears_api.h" |
| 35 #include "chrome/common/navigation_types.h" | 34 #include "chrome/common/navigation_types.h" |
| 36 #include "chrome/common/notification_registrar.h" | 35 #include "chrome/common/notification_registrar.h" |
| 37 #include "chrome/common/property_bag.h" | 36 #include "chrome/common/property_bag.h" |
| 38 #include "chrome/common/renderer_preferences.h" | 37 #include "chrome/common/renderer_preferences.h" |
| 39 #include "net/base/load_states.h" | 38 #include "net/base/load_states.h" |
| 40 #include "webkit/glue/password_form.h" | 39 #include "webkit/glue/password_form.h" |
| 41 #include "webkit/glue/webpreferences.h" | 40 #include "webkit/glue/webpreferences.h" |
| 42 | 41 |
| 43 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 namespace IPC { | 66 namespace IPC { |
| 68 class Message; | 67 class Message; |
| 69 } | 68 } |
| 70 | 69 |
| 71 class FormFieldHistoryManager; | 70 class FormFieldHistoryManager; |
| 72 class BlockedPopupContainer; | 71 class BlockedPopupContainer; |
| 73 class DOMUI; | 72 class DOMUI; |
| 74 class DownloadItem; | 73 class DownloadItem; |
| 75 class LoadNotificationDetails; | 74 class LoadNotificationDetails; |
| 76 class OmniboxSearchHint; | 75 class OmniboxSearchHint; |
| 77 class PageAction; | |
| 78 class PasswordManager; | 76 class PasswordManager; |
| 79 class PluginInstaller; | 77 class PluginInstaller; |
| 80 class Profile; | 78 class Profile; |
| 81 struct RendererPreferences; | 79 struct RendererPreferences; |
| 82 class RenderViewHost; | 80 class RenderViewHost; |
| 83 class TabContentsDelegate; | 81 class TabContentsDelegate; |
| 84 class TabContentsFactory; | 82 class TabContentsFactory; |
| 85 class SkBitmap; | 83 class SkBitmap; |
| 86 class SiteInstance; | 84 class SiteInstance; |
| 87 class TabContentsView; | 85 class TabContentsView; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // This flag indicates whether the tab contents is currently being | 246 // This flag indicates whether the tab contents is currently being |
| 249 // screenshotted by the DraggedTabController. | 247 // screenshotted by the DraggedTabController. |
| 250 bool capturing_contents() const { return capturing_contents_; } | 248 bool capturing_contents() const { return capturing_contents_; } |
| 251 void set_capturing_contents(bool cap) { capturing_contents_ = cap; } | 249 void set_capturing_contents(bool cap) { capturing_contents_ = cap; } |
| 252 | 250 |
| 253 // Indicates whether this tab should be considered crashed. The setter will | 251 // Indicates whether this tab should be considered crashed. The setter will |
| 254 // also notify the delegate when the flag is changed. | 252 // also notify the delegate when the flag is changed. |
| 255 bool is_crashed() const { return is_crashed_; } | 253 bool is_crashed() const { return is_crashed_; } |
| 256 void SetIsCrashed(bool state); | 254 void SetIsCrashed(bool state); |
| 257 | 255 |
| 258 // Adds/removes a page action to the list of page actions that are active in | 256 // Call this after updating a page action to notify clients about the changes. |
| 259 // this tab. The parameter |title| (if not empty) can be used to override the | |
| 260 // page action title for this tab and |icon_id| specifies an icon index | |
| 261 // (defined in the manifest) to use instead of the first icon (for this tab). | |
| 262 void SetPageActionEnabled(const ExtensionAction* page_action, bool enable, | |
| 263 const std::string& title, int icon_id); | |
| 264 | |
| 265 // Returns the page action state for this tab. The pair returns contains | |
| 266 // the title (string) for the page action and the icon index to use (int). | |
| 267 // If this function returns NULL it means the page action is not enabled for | |
| 268 // this tab. | |
| 269 const ExtensionActionState* GetPageActionState( | |
| 270 const ExtensionAction* page_action); | |
| 271 | |
| 272 // Same as above, but creates an enable state if it doesn't exist. The return | |
| 273 // value can be updated. The caller should call PageActionStateChanged when | |
| 274 // done modifying the state. | |
| 275 ExtensionActionState* GetOrCreatePageActionState( | |
| 276 const ExtensionAction* page_action); | |
| 277 | |
| 278 // Call this after updating a ExtensionActionState object returned by | |
| 279 // GetOrCreatePageActionState to notify clients about the changes. | |
| 280 void PageActionStateChanged(); | 257 void PageActionStateChanged(); |
| 281 | 258 |
| 282 // Whether the tab is in the process of being destroyed. | 259 // Whether the tab is in the process of being destroyed. |
| 283 // Added as a tentative work-around for focus related bug #4633. This allows | 260 // Added as a tentative work-around for focus related bug #4633. This allows |
| 284 // us not to store focus when a tab is being closed. | 261 // us not to store focus when a tab is being closed. |
| 285 bool is_being_destroyed() const { return is_being_destroyed_; } | 262 bool is_being_destroyed() const { return is_being_destroyed_; } |
| 286 | 263 |
| 287 // Convenience method for notifying the delegate of a navigation state | 264 // Convenience method for notifying the delegate of a navigation state |
| 288 // change. See TabContentsDelegate. | 265 // change. See TabContentsDelegate. |
| 289 void NotifyNavigationStateChanged(unsigned changed_flags); | 266 void NotifyNavigationStateChanged(unsigned changed_flags); |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 bool last_search_case_sensitive_; | 1097 bool last_search_case_sensitive_; |
| 1121 | 1098 |
| 1122 // Keeps track of the last search string that was used to search in any tab. | 1099 // Keeps track of the last search string that was used to search in any tab. |
| 1123 string16* last_search_prepopulate_text_; | 1100 string16* last_search_prepopulate_text_; |
| 1124 | 1101 |
| 1125 // The last find result. This object contains details about the number of | 1102 // The last find result. This object contains details about the number of |
| 1126 // matches, the find selection rectangle, etc. The UI can access this | 1103 // matches, the find selection rectangle, etc. The UI can access this |
| 1127 // information to build its presentation. | 1104 // information to build its presentation. |
| 1128 FindNotificationDetails last_search_result_; | 1105 FindNotificationDetails last_search_result_; |
| 1129 | 1106 |
| 1130 // Data for Page Actions ----------------------------------------------------- | |
| 1131 | |
| 1132 // A map of page actions that this tab knows about (and a state object that | |
| 1133 // can be used to update the title, icon, visibilty, etc used for the page | |
| 1134 // action). This map is cleared every time the mainframe navigates and | |
| 1135 // populated by the PageAction extension API. | |
| 1136 typedef std::map< const ExtensionAction*, linked_ptr<ExtensionActionState> > | |
| 1137 PageActionStateMap; | |
| 1138 PageActionStateMap page_actions_; | |
| 1139 | |
| 1140 // Data for misc internal state ---------------------------------------------- | 1107 // Data for misc internal state ---------------------------------------------- |
| 1141 | 1108 |
| 1142 // See capturing_contents() above. | 1109 // See capturing_contents() above. |
| 1143 bool capturing_contents_; | 1110 bool capturing_contents_; |
| 1144 | 1111 |
| 1145 // See getter above. | 1112 // See getter above. |
| 1146 bool is_being_destroyed_; | 1113 bool is_being_destroyed_; |
| 1147 | 1114 |
| 1148 // Indicates whether we should notify about disconnection of this | 1115 // Indicates whether we should notify about disconnection of this |
| 1149 // TabContents. This is used to ensure disconnection notifications only | 1116 // TabContents. This is used to ensure disconnection notifications only |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 | 1157 |
| 1191 // The time that we started to close the tab. | 1158 // The time that we started to close the tab. |
| 1192 base::TimeTicks tab_close_start_time_; | 1159 base::TimeTicks tab_close_start_time_; |
| 1193 | 1160 |
| 1194 // --------------------------------------------------------------------------- | 1161 // --------------------------------------------------------------------------- |
| 1195 | 1162 |
| 1196 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1163 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 1197 }; | 1164 }; |
| 1198 | 1165 |
| 1199 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1166 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |