| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "content/browser/tab_contents/navigation_entry.h" | 13 #include "content/browser/tab_contents/navigation_entry.h" |
| 13 #include "content/common/navigation_types.h" | 14 #include "content/common/navigation_types.h" |
| 14 #include "content/common/page_transition_types.h" | 15 #include "content/common/page_transition_types.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 16 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 class HtmlDialogUIDelegate; | 35 class HtmlDialogUIDelegate; |
| 35 struct NativeWebKeyboardEvent; | 36 struct NativeWebKeyboardEvent; |
| 36 class Profile; | 37 class Profile; |
| 37 class RenderViewHost; | 38 class RenderViewHost; |
| 38 class TabContents; | 39 class TabContents; |
| 39 | 40 |
| 40 // Objects implement this interface to get notified about changes in the | 41 // Objects implement this interface to get notified about changes in the |
| 41 // TabContents and to provide necessary functionality. | 42 // TabContents and to provide necessary functionality. |
| 42 class TabContentsDelegate { | 43 class TabContentsDelegate { |
| 43 public: | 44 public: |
| 45 TabContentsDelegate(); |
| 46 |
| 44 // When a main frame navigation occurs CreateMainFrameCommitDetails() is | 47 // When a main frame navigation occurs CreateMainFrameCommitDetails() is |
| 45 // invoked. The |MainFrameCommitDetails| returned from | 48 // invoked. The |MainFrameCommitDetails| returned from |
| 46 // CreateMainFrameCommitDetails() are then passed to | 49 // CreateMainFrameCommitDetails() are then passed to |
| 47 // DidNavigateMainFramePostCommit. This allows the delegate to save state | 50 // DidNavigateMainFramePostCommit. This allows the delegate to save state |
| 48 // before the commit and get that state after the commit. | 51 // before the commit and get that state after the commit. |
| 49 struct MainFrameCommitDetails { | 52 struct MainFrameCommitDetails { |
| 50 virtual ~MainFrameCommitDetails() {} | 53 virtual ~MainFrameCommitDetails() {} |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 // Opens a new URL inside the passed in TabContents (if source is 0 open | 56 // Opens a new URL inside the passed in TabContents (if source is 0 open |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 TabContents* tab, | 300 TabContents* tab, |
| 298 const MainFrameCommitDetails& details); | 301 const MainFrameCommitDetails& details); |
| 299 | 302 |
| 300 // Returns a pointer to a service to create JavaScript dialogs. The default | 303 // Returns a pointer to a service to create JavaScript dialogs. The default |
| 301 // pointer returned is to a stub service that marks all dialogs as suppressed | 304 // pointer returned is to a stub service that marks all dialogs as suppressed |
| 302 // and displays nothing. | 305 // and displays nothing. |
| 303 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator(); | 306 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator(); |
| 304 | 307 |
| 305 protected: | 308 protected: |
| 306 virtual ~TabContentsDelegate(); | 309 virtual ~TabContentsDelegate(); |
| 310 |
| 311 private: |
| 312 friend class TabContents; |
| 313 |
| 314 // Called when |this| becomes the TabContentsDelegate for |source|. |
| 315 void Attach(TabContents* source); |
| 316 |
| 317 // Called when |this| is no longer the TabContentsDelegate for |source|. |
| 318 void Detach(TabContents* source); |
| 319 |
| 320 // The TabContents that this is currently a delegate for. |
| 321 std::set<TabContents*> attached_contents_; |
| 307 }; | 322 }; |
| 308 | 323 |
| 309 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ | 324 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |