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_CLOSEABLE_STATE_WATCHER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CLOSEABLE_STATE_WATCHER_H_ |
6 #define CHROME_BROWSER_TAB_CLOSEABLE_STATE_WATCHER_H_ | 6 #define CHROME_BROWSER_TAB_CLOSEABLE_STATE_WATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 static TabCloseableStateWatcher* Create(); | 25 static TabCloseableStateWatcher* Create(); |
26 | 26 |
27 // Called from Browser::CanCloseTab which overrides TabStripModelDelegate:: | 27 // Called from Browser::CanCloseTab which overrides TabStripModelDelegate:: |
28 // CanCloseTab, and returns true if tab of browser is closeable. | 28 // CanCloseTab, and returns true if tab of browser is closeable. |
29 // Browser::CanCloseTab is in turn called by Browser, TabStripModel and | 29 // Browser::CanCloseTab is in turn called by Browser, TabStripModel and |
30 // BrowserTabStripController when: | 30 // BrowserTabStripController when: |
31 // - rendering tab to determine if close button should be drawn | 31 // - rendering tab to determine if close button should be drawn |
32 // - setting up tab's context menu to determine if "Close tab" should | 32 // - setting up tab's context menu to determine if "Close tab" should |
33 // should be enabled | 33 // should be enabled |
34 // - determining if accelerator keys to close tab should be processed | 34 // - determining if accelerator keys to close tab should be processed |
35 virtual bool CanCloseTab(const Browser* browser) const { | 35 virtual bool CanCloseTab(const Browser* browser) const; |
36 return true; | |
37 } | |
38 | 36 |
39 // Called from Browser::IsClosingPermitted which is in turn called from | 37 // Called from Browser::IsClosingPermitted which is in turn called from |
40 // Browser::ShouldCloseWindow to check if |browser| can be closed. | 38 // Browser::ShouldCloseWindow to check if |browser| can be closed. |
41 virtual bool CanCloseBrowser(Browser* browser) { | 39 virtual bool CanCloseBrowser(Browser* browser); |
42 return true; | |
43 } | |
44 | 40 |
45 // Called from Browser::CancelWindowClose when closing of window is canceled. | 41 // Called from Browser::CancelWindowClose when closing of window is canceled. |
46 // Watcher is potentially interested in this, especially when the closing of | 42 // Watcher is potentially interested in this, especially when the closing of |
47 // window was initiated by application exiting. | 43 // window was initiated by application exiting. |
48 virtual void OnWindowCloseCanceled(Browser* browser) {} | 44 virtual void OnWindowCloseCanceled(Browser* browser) {} |
49 | 45 |
50 private: | 46 private: |
51 DISALLOW_COPY_AND_ASSIGN(TabCloseableStateWatcher); | 47 DISALLOW_COPY_AND_ASSIGN(TabCloseableStateWatcher); |
52 }; | 48 }; |
53 | 49 |
54 #endif // CHROME_BROWSER_TAB_CLOSEABLE_STATE_WATCHER_H_ | 50 #endif // CHROME_BROWSER_TAB_CLOSEABLE_STATE_WATCHER_H_ |
OLD | NEW |