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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/shell_dialogs.h" | 24 #include "chrome/browser/shell_dialogs.h" |
25 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 25 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
26 #include "chrome/browser/renderer_host/render_view_host_manager.h" | 26 #include "chrome/browser/renderer_host/render_view_host_manager.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/page_navigator.h" | 30 #include "chrome/browser/tab_contents/page_navigator.h" |
31 #include "chrome/common/gears_api.h" | 31 #include "chrome/common/gears_api.h" |
32 #include "chrome/common/navigation_types.h" | 32 #include "chrome/common/navigation_types.h" |
33 #include "chrome/common/notification_registrar.h" | 33 #include "chrome/common/notification_registrar.h" |
| 34 #include "chrome/common/page_action.h" |
34 #include "chrome/common/property_bag.h" | 35 #include "chrome/common/property_bag.h" |
35 #include "chrome/common/renderer_preferences.h" | 36 #include "chrome/common/renderer_preferences.h" |
36 #include "net/base/load_states.h" | 37 #include "net/base/load_states.h" |
37 #include "webkit/glue/password_form.h" | 38 #include "webkit/glue/password_form.h" |
38 #include "webkit/glue/webpreferences.h" | 39 #include "webkit/glue/webpreferences.h" |
39 | 40 |
40 #if defined(OS_MACOSX) || defined(OS_LINUX) | 41 #if defined(OS_MACOSX) || defined(OS_LINUX) |
41 // Remove when we've finished porting the supporting classes. | 42 // Remove when we've finished porting the supporting classes. |
42 #include "chrome/common/temp_scaffolding_stubs.h" | 43 #include "chrome/common/temp_scaffolding_stubs.h" |
43 #elif defined(OS_WIN) | 44 #elif defined(OS_WIN) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // screenshotted by the DraggedTabController. | 247 // screenshotted by the DraggedTabController. |
247 bool capturing_contents() const { return capturing_contents_; } | 248 bool capturing_contents() const { return capturing_contents_; } |
248 void set_capturing_contents(bool cap) { capturing_contents_ = cap; } | 249 void set_capturing_contents(bool cap) { capturing_contents_ = cap; } |
249 | 250 |
250 // Indicates whether this tab should be considered crashed. The setter will | 251 // Indicates whether this tab should be considered crashed. The setter will |
251 // also notify the delegate when the flag is changed. | 252 // also notify the delegate when the flag is changed. |
252 bool is_crashed() const { return is_crashed_; } | 253 bool is_crashed() const { return is_crashed_; } |
253 void SetIsCrashed(bool state); | 254 void SetIsCrashed(bool state); |
254 | 255 |
255 // Adds/removes a page action to the list of page actions that are active in | 256 // Adds/removes a page action to the list of page actions that are active in |
| 257 // this tab. The parameter |title| (if not empty) can be used to override the |
| 258 // page action title for this tab and |icon_id| specifies an icon index |
| 259 // (defined in the manifest) to use instead of the first icon (for this tab). |
| 260 void SetPageActionEnabled(const PageAction* page_action, bool enable, |
| 261 const std::string& title, int icon_id); |
| 262 |
| 263 // Returns the page action state for this tab. The pair returns contains |
| 264 // the title (string) for the page action and the icon index to use (int). |
| 265 // If this function returns NULL it means the page action is not enabled for |
256 // this tab. | 266 // this tab. |
257 void SetPageActionEnabled(const PageAction* page_action, bool enable); | 267 const PageActionState* GetPageActionState(const PageAction* page_action); |
258 // Checks to see if the PageAction should be visible in this tab. | |
259 bool IsPageActionEnabled(const PageAction* page_action); | |
260 | 268 |
261 // Whether the tab is in the process of being destroyed. | 269 // Whether the tab is in the process of being destroyed. |
262 // Added as a tentative work-around for focus related bug #4633. This allows | 270 // Added as a tentative work-around for focus related bug #4633. This allows |
263 // us not to store focus when a tab is being closed. | 271 // us not to store focus when a tab is being closed. |
264 bool is_being_destroyed() const { return is_being_destroyed_; } | 272 bool is_being_destroyed() const { return is_being_destroyed_; } |
265 | 273 |
266 // Convenience method for notifying the delegate of a navigation state | 274 // Convenience method for notifying the delegate of a navigation state |
267 // change. See TabContentsDelegate. | 275 // change. See TabContentsDelegate. |
268 void NotifyNavigationStateChanged(unsigned changed_flags); | 276 void NotifyNavigationStateChanged(unsigned changed_flags); |
269 | 277 |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 // Keeps track of the last search string that was used to search in any tab. | 1035 // Keeps track of the last search string that was used to search in any tab. |
1028 string16* last_search_prepopulate_text_; | 1036 string16* last_search_prepopulate_text_; |
1029 | 1037 |
1030 // The last find result. This object contains details about the number of | 1038 // The last find result. This object contains details about the number of |
1031 // matches, the find selection rectangle, etc. The UI can access this | 1039 // matches, the find selection rectangle, etc. The UI can access this |
1032 // information to build its presentation. | 1040 // information to build its presentation. |
1033 FindNotificationDetails last_search_result_; | 1041 FindNotificationDetails last_search_result_; |
1034 | 1042 |
1035 // Data for Page Actions ----------------------------------------------------- | 1043 // Data for Page Actions ----------------------------------------------------- |
1036 | 1044 |
1037 // A set of page actions that are enabled in this tab. This list is cleared | 1045 // A map of page actions that are enabled in this tab (and a state object |
1038 // every time the mainframe navigates and populated by the PageAction | 1046 // that can be used to override the title and icon used for the page action). |
1039 // extension API. | 1047 // This map is cleared every time the mainframe navigates and populated by the |
1040 std::set<const PageAction*> enabled_page_actions_; | 1048 // PageAction extension API. |
| 1049 std::map<const PageAction*, linked_ptr<PageActionState>> |
| 1050 enabled_page_actions_; |
1041 | 1051 |
1042 // Data for misc internal state ---------------------------------------------- | 1052 // Data for misc internal state ---------------------------------------------- |
1043 | 1053 |
1044 // See capturing_contents() above. | 1054 // See capturing_contents() above. |
1045 bool capturing_contents_; | 1055 bool capturing_contents_; |
1046 | 1056 |
1047 // See getter above. | 1057 // See getter above. |
1048 bool is_being_destroyed_; | 1058 bool is_being_destroyed_; |
1049 | 1059 |
1050 // Indicates whether we should notify about disconnection of this | 1060 // Indicates whether we should notify about disconnection of this |
(...skipping 19 matching lines...) Expand all Loading... |
1070 // True if the user has decided to block future javascript messages. This is | 1080 // True if the user has decided to block future javascript messages. This is |
1071 // reset on navigations to false on navigations. | 1081 // reset on navigations to false on navigations. |
1072 bool suppress_javascript_messages_; | 1082 bool suppress_javascript_messages_; |
1073 | 1083 |
1074 // --------------------------------------------------------------------------- | 1084 // --------------------------------------------------------------------------- |
1075 | 1085 |
1076 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1086 DISALLOW_COPY_AND_ASSIGN(TabContents); |
1077 }; | 1087 }; |
1078 | 1088 |
1079 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1089 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |