| 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> | |
| 10 #include <string> | 9 #include <string> |
| 11 | 10 |
| 12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 13 #include "content/browser/tab_contents/navigation_entry.h" | 12 #include "content/browser/tab_contents/navigation_entry.h" |
| 14 #include "content/common/navigation_types.h" | 13 #include "content/common/navigation_types.h" |
| 15 #include "content/common/page_transition_types.h" | 14 #include "content/common/page_transition_types.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 17 #include "webkit/glue/window_open_disposition.h" | 16 #include "webkit/glue/window_open_disposition.h" |
| 18 | 17 |
| 19 namespace content { | 18 namespace content { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 class HtmlDialogUIDelegate; | 34 class HtmlDialogUIDelegate; |
| 36 struct NativeWebKeyboardEvent; | 35 struct NativeWebKeyboardEvent; |
| 37 class Profile; | 36 class Profile; |
| 38 class RenderViewHost; | 37 class RenderViewHost; |
| 39 class TabContents; | 38 class TabContents; |
| 40 | 39 |
| 41 // Objects implement this interface to get notified about changes in the | 40 // Objects implement this interface to get notified about changes in the |
| 42 // TabContents and to provide necessary functionality. | 41 // TabContents and to provide necessary functionality. |
| 43 class TabContentsDelegate { | 42 class TabContentsDelegate { |
| 44 public: | 43 public: |
| 45 TabContentsDelegate(); | |
| 46 | |
| 47 // When a main frame navigation occurs CreateMainFrameCommitDetails() is | 44 // When a main frame navigation occurs CreateMainFrameCommitDetails() is |
| 48 // invoked. The |MainFrameCommitDetails| returned from | 45 // invoked. The |MainFrameCommitDetails| returned from |
| 49 // CreateMainFrameCommitDetails() are then passed to | 46 // CreateMainFrameCommitDetails() are then passed to |
| 50 // DidNavigateMainFramePostCommit. This allows the delegate to save state | 47 // DidNavigateMainFramePostCommit. This allows the delegate to save state |
| 51 // before the commit and get that state after the commit. | 48 // before the commit and get that state after the commit. |
| 52 struct MainFrameCommitDetails { | 49 struct MainFrameCommitDetails { |
| 53 virtual ~MainFrameCommitDetails() {} | 50 virtual ~MainFrameCommitDetails() {} |
| 54 }; | 51 }; |
| 55 | 52 |
| 56 // Opens a new URL inside the passed in TabContents (if source is 0 open | 53 // 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... |
| 300 TabContents* tab, | 297 TabContents* tab, |
| 301 const MainFrameCommitDetails& details); | 298 const MainFrameCommitDetails& details); |
| 302 | 299 |
| 303 // Returns a pointer to a service to create JavaScript dialogs. The default | 300 // Returns a pointer to a service to create JavaScript dialogs. The default |
| 304 // pointer returned is to a stub service that marks all dialogs as suppressed | 301 // pointer returned is to a stub service that marks all dialogs as suppressed |
| 305 // and displays nothing. | 302 // and displays nothing. |
| 306 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator(); | 303 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator(); |
| 307 | 304 |
| 308 protected: | 305 protected: |
| 309 virtual ~TabContentsDelegate(); | 306 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_; | |
| 322 }; | 307 }; |
| 323 | 308 |
| 324 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ | 309 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |