Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.h

Issue 269079: Implement new page action API. (Closed)
Patch Set: compile fixes Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void SetPageActionEnabled(const ExtensionAction* page_action, bool enable, 262 void SetPageActionEnabled(const ExtensionAction* page_action, bool enable,
263 const std::string& title, int icon_id); 263 const std::string& title, int icon_id);
264 264
265 // Returns the page action state for this tab. The pair returns contains 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). 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 267 // If this function returns NULL it means the page action is not enabled for
268 // this tab. 268 // this tab.
269 const ExtensionActionState* GetPageActionState( 269 const ExtensionActionState* GetPageActionState(
270 const ExtensionAction* page_action); 270 const ExtensionAction* page_action);
271 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();
281
272 // Whether the tab is in the process of being destroyed. 282 // Whether the tab is in the process of being destroyed.
273 // Added as a tentative work-around for focus related bug #4633. This allows 283 // Added as a tentative work-around for focus related bug #4633. This allows
274 // us not to store focus when a tab is being closed. 284 // us not to store focus when a tab is being closed.
275 bool is_being_destroyed() const { return is_being_destroyed_; } 285 bool is_being_destroyed() const { return is_being_destroyed_; }
276 286
277 // Convenience method for notifying the delegate of a navigation state 287 // Convenience method for notifying the delegate of a navigation state
278 // change. See TabContentsDelegate. 288 // change. See TabContentsDelegate.
279 void NotifyNavigationStateChanged(unsigned changed_flags); 289 void NotifyNavigationStateChanged(unsigned changed_flags);
280 290
281 // Invoked when the tab contents becomes selected. If you override, be sure 291 // Invoked when the tab contents becomes selected. If you override, be sure
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 // Keeps track of the last search string that was used to search in any tab. 1114 // Keeps track of the last search string that was used to search in any tab.
1105 string16* last_search_prepopulate_text_; 1115 string16* last_search_prepopulate_text_;
1106 1116
1107 // The last find result. This object contains details about the number of 1117 // The last find result. This object contains details about the number of
1108 // matches, the find selection rectangle, etc. The UI can access this 1118 // matches, the find selection rectangle, etc. The UI can access this
1109 // information to build its presentation. 1119 // information to build its presentation.
1110 FindNotificationDetails last_search_result_; 1120 FindNotificationDetails last_search_result_;
1111 1121
1112 // Data for Page Actions ----------------------------------------------------- 1122 // Data for Page Actions -----------------------------------------------------
1113 1123
1114 // A map of page actions that are enabled in this tab (and a state object 1124 // A map of page actions that this tab knows about (and a state object that
1115 // that can be used to override the title and icon used for the page action). 1125 // can be used to update the title, icon, visibilty, etc used for the page
1116 // This map is cleared every time the mainframe navigates and populated by the 1126 // action). This map is cleared every time the mainframe navigates and
1117 // PageAction extension API. 1127 // populated by the PageAction extension API.
1118 std::map< const ExtensionAction*, linked_ptr<ExtensionActionState> > 1128 typedef std::map< const ExtensionAction*, linked_ptr<ExtensionActionState> >
1119 enabled_page_actions_; 1129 PageActionStateMap;
1130 PageActionStateMap page_actions_;
1120 1131
1121 // Data for misc internal state ---------------------------------------------- 1132 // Data for misc internal state ----------------------------------------------
1122 1133
1123 // See capturing_contents() above. 1134 // See capturing_contents() above.
1124 bool capturing_contents_; 1135 bool capturing_contents_;
1125 1136
1126 // See getter above. 1137 // See getter above.
1127 bool is_being_destroyed_; 1138 bool is_being_destroyed_;
1128 1139
1129 // Indicates whether we should notify about disconnection of this 1140 // Indicates whether we should notify about disconnection of this
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 1182
1172 // The time that we started to close the tab. 1183 // The time that we started to close the tab.
1173 base::TimeTicks tab_close_start_time_; 1184 base::TimeTicks tab_close_start_time_;
1174 1185
1175 // --------------------------------------------------------------------------- 1186 // ---------------------------------------------------------------------------
1176 1187
1177 DISALLOW_COPY_AND_ASSIGN(TabContents); 1188 DISALLOW_COPY_AND_ASSIGN(TabContents);
1178 }; 1189 };
1179 1190
1180 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 1191 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698