| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_DOM_UI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
| 7 |
| 8 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 9 |
| 10 class Browser; |
| 11 class Profile; |
| 12 |
| 13 // This class implements (and mostly ignores) most of TabContentsDelegate for |
| 14 // use in an HTML dialog. Subclasses need only override a few methods instead |
| 15 // of the everything from TabContentsDelegate; this way, implementations on |
| 16 // all platforms behave consistently. |
| 17 |
| 18 class HtmlDialogTabContentsDelegate : public TabContentsDelegate { |
| 19 public: |
| 20 // Profile must be non-NULL. |
| 21 explicit HtmlDialogTabContentsDelegate(Profile* profile); |
| 22 |
| 23 virtual ~HtmlDialogTabContentsDelegate(); |
| 24 |
| 25 // The returned profile is guaranteed to be original if non-NULL. |
| 26 Profile* profile() const; |
| 27 |
| 28 // Calling this causes all following events sent from the |
| 29 // TabContents object to be ignored. It also makes all following |
| 30 // calls to profile() return NULL. |
| 31 void Detach(); |
| 32 |
| 33 // TabContentsDelegate declarations. Subclasses of this still need to |
| 34 // override: |
| 35 // virtual void MoveContents(TabContents* source, const gfx::Rect& pos); |
| 36 // virtual void ToolbarSizeChanged(TabContents* source, bool is_animating); |
| 37 |
| 38 virtual void OpenURLFromTab(TabContents* source, |
| 39 const GURL& url, const GURL& referrer, |
| 40 WindowOpenDisposition disposition, |
| 41 PageTransition::Type transition); |
| 42 virtual void NavigationStateChanged(const TabContents* source, |
| 43 unsigned changed_flags); |
| 44 virtual void AddNewContents(TabContents* source, |
| 45 TabContents* new_contents, |
| 46 WindowOpenDisposition disposition, |
| 47 const gfx::Rect& initial_pos, |
| 48 bool user_gesture); |
| 49 virtual void ActivateContents(TabContents* contents); |
| 50 virtual void LoadingStateChanged(TabContents* source); |
| 51 virtual void CloseContents(TabContents* source); |
| 52 virtual bool IsPopup(TabContents* source); |
| 53 virtual void URLStarredChanged(TabContents* source, bool starred); |
| 54 virtual void UpdateTargetURL(TabContents* source, const GURL& url); |
| 55 virtual bool ShouldAddNavigationToHistory() const; |
| 56 |
| 57 protected: |
| 58 // Overridden only for testing. |
| 59 virtual Browser* CreateBrowser(); |
| 60 |
| 61 private: |
| 62 Profile* profile_; // Weak pointer. Always an original profile. |
| 63 }; |
| 64 |
| 65 #endif // CHROME_BROWSER_DOM_UI_HTML_DIALOG_TAB_CONTENTS_DELEGATE_H_ |
| 66 |
| OLD | NEW |