| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_INSTANT_INSTANT_UNLOAD_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_ | 6 #define CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 | 10 |
| 11 class Browser; | 11 class Browser; |
| 12 class TabContents; | 12 class TabContents; |
| 13 | 13 |
| 14 // InstantUnloadHandler ensures that the beforeunload and unload handlers are | 14 // InstantUnloadHandler ensures that the beforeunload and unload handlers are |
| 15 // run when using Instant. When the user commits the Instant preview the | 15 // run when using Instant. When the user commits the Instant preview the |
| 16 // existing TabContents is passed to |RunUnloadListenersOrDestroy|. If the tab | 16 // existing TabContents is passed to RunUnloadListenersOrDestroy(). If the tab |
| 17 // has no beforeunload or unload listeners, the tab is deleted; otherwise the | 17 // has no beforeunload or unload listeners, the tab is deleted; otherwise the |
| 18 // beforeunload and unload listeners are executed. If the beforeunload listener | 18 // beforeunload and unload listeners are executed. If the beforeunload listener |
| 19 // shows a dialog the tab is added back to the tabstrip at its original location | 19 // shows a dialog the tab is added back to the tabstrip at its original location |
| 20 // next to the Instant page. | 20 // next to the Instant page. |
| 21 class InstantUnloadHandler { | 21 class InstantUnloadHandler { |
| 22 public: | 22 public: |
| 23 explicit InstantUnloadHandler(Browser* browser); | 23 explicit InstantUnloadHandler(Browser* browser); |
| 24 ~InstantUnloadHandler(); | 24 ~InstantUnloadHandler(); |
| 25 | 25 |
| 26 // See class description for details on what this does. | 26 // See class description for details on what this does. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 39 // TODO(sky): Browser really needs to wait to close until there are no more | 39 // TODO(sky): Browser really needs to wait to close until there are no more |
| 40 // tabs managed by InstantUnloadHandler. | 40 // tabs managed by InstantUnloadHandler. |
| 41 Browser* const browser_; | 41 Browser* const browser_; |
| 42 | 42 |
| 43 ScopedVector<WebContentsDelegateImpl> delegates_; | 43 ScopedVector<WebContentsDelegateImpl> delegates_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(InstantUnloadHandler); | 45 DISALLOW_COPY_AND_ASSIGN(InstantUnloadHandler); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 #endif // CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_ | 48 #endif // CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_ |
| OLD | NEW |