| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // The TabContentsView is an interface that is implemented by the platform- | 24 // The TabContentsView is an interface that is implemented by the platform- |
| 25 // dependent web contents views. The TabContents uses this interface to talk to | 25 // dependent web contents views. The TabContents uses this interface to talk to |
| 26 // them. View-related messages will also get forwarded directly to this class | 26 // them. View-related messages will also get forwarded directly to this class |
| 27 // from RenderViewHost via RenderViewHostDelegate::View. | 27 // from RenderViewHost via RenderViewHostDelegate::View. |
| 28 // | 28 // |
| 29 // It contains a small amount of logic with respect to creating new sub-view | 29 // It contains a small amount of logic with respect to creating new sub-view |
| 30 // that should be the same for all platforms. | 30 // that should be the same for all platforms. |
| 31 class TabContentsView : public RenderViewHostDelegate::View { | 31 class TabContentsView : public RenderViewHostDelegate::View { |
| 32 public: | 32 public: |
| 33 explicit TabContentsView(TabContents* tab_contents); | 33 explicit TabContentsView(TabContents* tab_contents); |
| 34 virtual ~TabContentsView() {} | 34 virtual ~TabContentsView(); |
| 35 | 35 |
| 36 // Creates the appropriate type of TabContentsView for the current system. | 36 // Creates the appropriate type of TabContentsView for the current system. |
| 37 // The return value is a new heap allocated view with ownership passing to | 37 // The return value is a new heap allocated view with ownership passing to |
| 38 // the caller. | 38 // the caller. |
| 39 static TabContentsView* Create(TabContents* tab_contents); | 39 static TabContentsView* Create(TabContents* tab_contents); |
| 40 | 40 |
| 41 TabContents* tab_contents() const { return tab_contents_; } | 41 TabContents* tab_contents() const { return tab_contents_; } |
| 42 | 42 |
| 43 virtual void CreateView(const gfx::Size& initial_size) = 0; | 43 virtual void CreateView(const gfx::Size& initial_size) = 0; |
| 44 | 44 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 virtual void HandleMouseLeave() {} | 135 virtual void HandleMouseLeave() {} |
| 136 virtual void HandleMouseUp(); | 136 virtual void HandleMouseUp(); |
| 137 virtual void HandleMouseActivate(); | 137 virtual void HandleMouseActivate(); |
| 138 | 138 |
| 139 // Notification that the preferred size of the contents has changed. | 139 // Notification that the preferred size of the contents has changed. |
| 140 virtual void UpdatePreferredSize(const gfx::Size& pref_size); | 140 virtual void UpdatePreferredSize(const gfx::Size& pref_size); |
| 141 | 141 |
| 142 // If we try to close the tab while a drag is in progress, we crash. These | 142 // If we try to close the tab while a drag is in progress, we crash. These |
| 143 // methods allow the tab contents to determine if a drag is in progress and | 143 // methods allow the tab contents to determine if a drag is in progress and |
| 144 // postpone the tab closing. | 144 // postpone the tab closing. |
| 145 virtual bool IsDoingDrag() const { | 145 virtual bool IsDoingDrag() const; |
| 146 return false; | |
| 147 } | |
| 148 virtual void CancelDragAndCloseTab() {} | 146 virtual void CancelDragAndCloseTab() {} |
| 149 | 147 |
| 150 // If we close the tab while a UI control is in an event-tracking | 148 // If we close the tab while a UI control is in an event-tracking |
| 151 // loop, the control may message freed objects and crash. | 149 // loop, the control may message freed objects and crash. |
| 152 // TabContents::Close() calls IsEventTracking(), and if it returns | 150 // TabContents::Close() calls IsEventTracking(), and if it returns |
| 153 // true CloseTabAfterEventTracking() is called and the close is not | 151 // true CloseTabAfterEventTracking() is called and the close is not |
| 154 // completed. | 152 // completed. |
| 155 virtual bool IsEventTracking() const { | 153 virtual bool IsEventTracking() const; |
| 156 return false; | |
| 157 } | |
| 158 virtual void CloseTabAfterEventTracking() {} | 154 virtual void CloseTabAfterEventTracking() {} |
| 159 | 155 |
| 160 virtual bool ShouldDrawDropShadow() { | 156 virtual bool ShouldDrawDropShadow(); |
| 161 return false; | |
| 162 } | |
| 163 | 157 |
| 164 protected: | 158 protected: |
| 165 TabContentsView() {} // Abstract interface. | 159 TabContentsView(); // Abstract interface. |
| 166 | 160 |
| 167 // Internal functions used to support the CreateNewWidget() method. If a | 161 // Internal functions used to support the CreateNewWidget() method. If a |
| 168 // platform requires plugging into widget creation at a lower level then a | 162 // platform requires plugging into widget creation at a lower level then a |
| 169 // subclass might want to override these functions, but otherwise they should | 163 // subclass might want to override these functions, but otherwise they should |
| 170 // be fine just implementing RenderWidgetHostView::InitAsPopup(). | 164 // be fine just implementing RenderWidgetHostView::InitAsPopup(). |
| 171 // | 165 // |
| 172 // The Create function returns the newly created widget so it can be | 166 // The Create function returns the newly created widget so it can be |
| 173 // associated with the given route. When the widget needs to be shown later, | 167 // associated with the given route. When the widget needs to be shown later, |
| 174 // we'll look it up again and pass the object to the Show functions rather | 168 // we'll look it up again and pass the object to the Show functions rather |
| 175 // than the route ID. | 169 // than the route ID. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 211 |
| 218 // These maps hold on to the widgets that we created on behalf of the | 212 // These maps hold on to the widgets that we created on behalf of the |
| 219 // renderer that haven't shown yet. | 213 // renderer that haven't shown yet. |
| 220 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 214 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; |
| 221 PendingWidgetViews pending_widget_views_; | 215 PendingWidgetViews pending_widget_views_; |
| 222 | 216 |
| 223 DISALLOW_COPY_AND_ASSIGN(TabContentsView); | 217 DISALLOW_COPY_AND_ASSIGN(TabContentsView); |
| 224 }; | 218 }; |
| 225 | 219 |
| 226 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_H_ | 220 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_H_ |
| OLD | NEW |