[email protected] | 2db5a204 | 2011-04-26 17:13:47 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 0b4d338 | 2010-07-14 16:13:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/tab_closeable_state_watcher.h" |
| 6 | |
| 7 | #include "base/command_line.h" |
| 8 | #include "chrome/common/chrome_switches.h" |
| 9 | |
| 10 | #if defined(OS_CHROMEOS) |
| 11 | #include "chrome/browser/chromeos/tab_closeable_state_watcher.h" |
| 12 | #endif // defined(OS_CHROMEOS) |
| 13 | |
| 14 | //////////////////////////////////////////////////////////////////////////////// |
| 15 | // TabCloseableStateWatcher, static: |
| 16 | |
| 17 | ::TabCloseableStateWatcher* ::TabCloseableStateWatcher::Create() { |
| 18 | ::TabCloseableStateWatcher* watcher = NULL; |
| 19 | #if defined(OS_CHROMEOS) |
| 20 | // We only watch closeable state of tab on chromeos, and only when it's not |
| 21 | // disabled (tests will have the disable switch). |
| 22 | if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 23 | switches::kDisableTabCloseableStateWatcher)) |
| 24 | watcher = new chromeos::TabCloseableStateWatcher(); |
| 25 | #endif // OS_CHROMEOS |
| 26 | if (!watcher) |
| 27 | watcher = new ::TabCloseableStateWatcher(); |
| 28 | return watcher; |
| 29 | } |
[email protected] | ddb1e5a | 2010-12-13 20:10:45 | [diff] [blame] | 30 | |
| 31 | bool TabCloseableStateWatcher::CanCloseTab(const Browser* browser) const { |
| 32 | return true; |
| 33 | } |
| 34 | |
[email protected] | 2db5a204 | 2011-04-26 17:13:47 | [diff] [blame] | 35 | bool TabCloseableStateWatcher::CanCloseTabs(const Browser* browser, |
| 36 | std::vector<int>* indices) const { |
| 37 | return true; |
| 38 | } |
| 39 | |
[email protected] | ddb1e5a | 2010-12-13 20:10:45 | [diff] [blame] | 40 | bool TabCloseableStateWatcher::CanCloseBrowser(Browser* browser) { |
| 41 | return true; |
| 42 | } |