| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/browser/tab_contents/page_navigator.h" | 9 #include "chrome/browser/tab_contents/page_navigator.h" |
| 10 #include "chrome/common/navigation_types.h" | 10 #include "chrome/common/navigation_types.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 // Opens a new URL inside the passed in TabContents, if source is 0 open | 24 // Opens a new URL inside the passed in TabContents, if source is 0 open |
| 25 // in the current front-most tab. | 25 // in the current front-most tab. |
| 26 virtual void OpenURLFromTab(TabContents* source, | 26 virtual void OpenURLFromTab(TabContents* source, |
| 27 const GURL& url, const GURL& referrer, | 27 const GURL& url, const GURL& referrer, |
| 28 WindowOpenDisposition disposition, | 28 WindowOpenDisposition disposition, |
| 29 PageTransition::Type transition) = 0; | 29 PageTransition::Type transition) = 0; |
| 30 | 30 |
| 31 virtual void OpenURL(const GURL& url, const GURL& referrer, | 31 virtual void OpenURL(const GURL& url, const GURL& referrer, |
| 32 WindowOpenDisposition disposition, | 32 WindowOpenDisposition disposition, |
| 33 PageTransition::Type transition) | 33 PageTransition::Type transition) { |
| 34 { | |
| 35 OpenURLFromTab(NULL, url, referrer, disposition, transition); | 34 OpenURLFromTab(NULL, url, referrer, disposition, transition); |
| 36 } | 35 } |
| 37 | 36 |
| 38 // Called to inform the delegate that the tab content's navigation state | 37 // Called to inform the delegate that the tab content's navigation state |
| 39 // changed. The |changed_flags| indicates the parts of the navigation state | 38 // changed. The |changed_flags| indicates the parts of the navigation state |
| 40 // that have been updated, and is any combination of the | 39 // that have been updated, and is any combination of the |
| 41 // |TabContents::InvalidateTypes| bits. | 40 // |TabContents::InvalidateTypes| bits. |
| 42 virtual void NavigationStateChanged(const TabContents* source, | 41 virtual void NavigationStateChanged(const TabContents* source, |
| 43 unsigned changed_flags) = 0; | 42 unsigned changed_flags) = 0; |
| 44 | 43 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Notification that the target URL has changed | 94 // Notification that the target URL has changed |
| 96 virtual void ContentsMouseEvent(TabContents* source, uint32 message) { } | 95 virtual void ContentsMouseEvent(TabContents* source, uint32 message) { } |
| 97 | 96 |
| 98 // Request the delegate to change the zoom level of the current tab. | 97 // Request the delegate to change the zoom level of the current tab. |
| 99 virtual void ContentsZoomChange(bool zoom_in) { } | 98 virtual void ContentsZoomChange(bool zoom_in) { } |
| 100 | 99 |
| 101 // Check whether this contents is inside a window dedicated to running a web | 100 // Check whether this contents is inside a window dedicated to running a web |
| 102 // application. | 101 // application. |
| 103 virtual bool IsApplication() { return false; } | 102 virtual bool IsApplication() { return false; } |
| 104 | 103 |
| 104 // Check whether or not the url should be opened in the default browser. |
| 105 virtual bool ShouldOpenURLInDefaultBrowser() const { return false; } |
| 106 |
| 105 // Detach the given tab and convert it to a "webapp" view. The tab must be | 107 // Detach the given tab and convert it to a "webapp" view. The tab must be |
| 106 // a WebContents with a valid WebApp set. | 108 // a WebContents with a valid WebApp set. |
| 107 virtual void ConvertContentsToApplication(TabContents* source) { } | 109 virtual void ConvertContentsToApplication(TabContents* source) { } |
| 108 | 110 |
| 109 // Informs the TabContentsDelegate that some of our state has changed | 111 // Informs the TabContentsDelegate that some of our state has changed |
| 110 // for this tab. | 112 // for this tab. |
| 111 virtual void ContentsStateChanged(TabContents* source) {} | 113 virtual void ContentsStateChanged(TabContents* source) {} |
| 112 | 114 |
| 113 // Return whether this tab contents should have a URL bar. Only web contents | 115 // Return whether this tab contents should have a URL bar. Only web contents |
| 114 // opened with a minimal chrome and their popups can be displayed without a | 116 // opened with a minimal chrome and their popups can be displayed without a |
| 115 // URL bar. | 117 // URL bar. |
| 116 virtual bool ShouldDisplayURLField() { return true; } | 118 virtual bool ShouldDisplayURLField() { return true; } |
| 117 | 119 |
| 118 // Whether this tab can be blurred through a javascript obj.blur() | 120 // Whether this tab can be blurred through a javascript obj.blur() |
| 119 // call. ConstrainedWindows shouldn't be able to be blurred. | 121 // call. ConstrainedWindows shouldn't be able to be blurred. |
| 120 virtual bool CanBlur() const { return true; } | 122 virtual bool CanBlur() const { return true; } |
| 121 | 123 |
| 122 // Show a dialog with HTML content. |delegate| contains a pointer to the | 124 // Show a dialog with HTML content. |delegate| contains a pointer to the |
| 123 // delegate who knows how to display the dialog (which file URL and JSON | 125 // delegate who knows how to display the dialog (which file URL and JSON |
| 124 // string input to use during initialization). |parent_window| is the window | 126 // string input to use during initialization). |parent_window| is the window |
| 125 // that should be parent of the dialog, or NULL for the default. | 127 // that should be parent of the dialog, or NULL for the default. |
| 126 virtual void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, | 128 virtual void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, |
| 127 void* parent_window) { } | 129 void* parent_window) { } |
| 128 | 130 |
| 129 // Tells us that we've finished firing this tab's beforeunload event. | 131 // Tells us that we've finished firing this tab's beforeunload event. |
| 130 // The proceed bool tells us whether the user chose to proceed closing the | 132 // The proceed bool tells us whether the user chose to proceed closing the |
| 131 // tab. Returns true if the tab can continue on firing it's unload event. | 133 // tab. Returns true if the tab can continue on firing it's unload event. |
| 132 // If we're closing the entire browser, then we'll want to delay firing | 134 // If we're closing the entire browser, then we'll want to delay firing |
| 133 // unload events until all the beforeunload events have fired. | 135 // unload events until all the beforeunload events have fired. |
| 134 virtual void BeforeUnloadFired(TabContents* tab, | 136 virtual void BeforeUnloadFired(TabContents* tab, |
| 135 bool proceed, | 137 bool proceed, |
| 136 bool* proceed_to_fire_unload) { | 138 bool* proceed_to_fire_unload) { |
| 137 *proceed_to_fire_unload = true; | 139 *proceed_to_fire_unload = true; |
| 138 } | 140 } |
| 139 | 141 |
| 140 // Send IPC to external host. Default implementation is do nothing. | 142 // Send IPC to external host. Default implementation is do nothing. |
| 141 virtual void ForwardMessageToExternalHost(const std::string& receiver, | 143 virtual void ForwardMessageToExternalHost(const std::string& receiver, |
| 142 const std::string& message) {}; | 144 const std::string& message) {}; |
| 143 | 145 |
| 144 // If the delegate is hosting tabs externally. | 146 // If the delegate is hosting tabs externally. |
| 145 virtual bool IsExternalTabContainer() const { return false; } | 147 virtual bool IsExternalTabContainer() const { return false; } |
| 146 }; | 148 }; |
| 147 | 149 |
| 148 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ | 150 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |