Index: chrome/browser/sidebar/sidebar_container.h |
=================================================================== |
--- chrome/browser/sidebar/sidebar_container.h (revision 74134) |
+++ chrome/browser/sidebar/sidebar_container.h (working copy) |
@@ -13,12 +13,21 @@ |
#include "chrome/browser/extensions/image_loading_tracker.h" |
#include "chrome/browser/tab_contents/tab_contents_delegate.h" |
-class BrowserWindow; |
-class Profile; |
-class RenderViewHost; |
+class SidebarContainer; |
class SkBitmap; |
class TabContents; |
+class TabContentsWrapper; |
+struct SidebarChangedDetails { |
+ enum UpdateType { |
+ SIDEBAR_STATE_CHANGED, |
+ SIDEBAR_PROPS_CHANGED, |
+ SIDEBAR_LOADING_STATE_CHANGED |
+ }; |
+ SidebarContainer* source; |
+ UpdateType update_type; |
+}; |
+ |
/////////////////////////////////////////////////////////////////////////////// |
// SidebarContainer |
// |
@@ -34,12 +43,12 @@ |
public: |
Delegate() {} |
virtual ~Delegate() {} |
- virtual void UpdateSidebar(SidebarContainer* host) = 0; |
+ virtual void UpdateSidebar(SidebarChangedDetails* details) = 0; |
private: |
DISALLOW_COPY_AND_ASSIGN(Delegate); |
}; |
- SidebarContainer(TabContents* tab, |
+ SidebarContainer(TabContentsWrapper* tab, |
const std::string& content_id, |
Delegate* delegate); |
virtual ~SidebarContainer(); |
@@ -54,8 +63,8 @@ |
// Returns sidebar's content id. |
const std::string& content_id() const { return content_id_; } |
- // Returns TabContents sidebar is linked to. |
- TabContents* tab_contents() const { return tab_; } |
+ // Returns TabContentsWrapper this sidebar is linked to. |
+ TabContentsWrapper* tab() const { return tab_; } |
// Returns sidebar's TabContents. |
TabContents* sidebar_contents() const { return sidebar_contents_.get(); } |
@@ -100,7 +109,7 @@ |
WindowOpenDisposition disposition, |
PageTransition::Type transition) {} |
virtual void NavigationStateChanged(const TabContents* source, |
- unsigned changed_flags) {} |
+ unsigned changed_flags); |
virtual void AddNewContents(TabContents* source, |
TabContents* new_contents, |
WindowOpenDisposition disposition, |
@@ -110,21 +119,29 @@ |
virtual void DeactivateContents(TabContents* contents) {} |
virtual void LoadingStateChanged(TabContents* source) {} |
virtual void CloseContents(TabContents* source) {} |
- virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {} |
- virtual bool IsPopup(const TabContents* source) const; |
+ virtual void MoveContents(TabContents* source, |
+ const gfx::Rect& pos) {} |
+ virtual void ToolbarSizeChanged(TabContents* source, |
+ bool is_animating) {} |
virtual void UpdateTargetURL(TabContents* source, const GURL& url) {} |
- virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {} |
+ virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
+ bool* is_keyboard_shortcut) OVERRIDE; |
+ virtual void HandleKeyboardEvent( |
+ const NativeWebKeyboardEvent& event) OVERRIDE; |
// Overridden from ImageLoadingTracker::Observer. |
virtual void OnImageLoaded(SkBitmap* image, |
ExtensionResource resource, |
int index); |
+ // Forwards update notification to delegate_. |
+ void NotifyUpdate(SidebarChangedDetails::UpdateType update_type); |
+ |
// Returns an extension this sidebar belongs to. |
const Extension* GetExtension() const; |
// Contents of the tab this sidebar is linked to. |
- TabContents* tab_; |
+ TabContentsWrapper* tab_; |
// Sidebar's content id. There might be more than one sidebar liked to each |
// particular tab and they are identified by their unique content id. |