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 #include "chrome/browser/ui/browser_synced_window_delegate.h" | 5 #include "chrome/browser/ui/browser_synced_window_delegate.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "chrome/browser/sessions/session_id.h" | 9 #include "chrome/browser/sessions/session_id.h" |
10 #include "chrome/browser/tabs/tab_strip_model.h" | 10 #include "chrome/browser/tabs/tab_strip_model.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 i != BrowserList::end(); ++i) { | 22 i != BrowserList::end(); ++i) { |
23 synced_window_delegates.insert((*i)->synced_window_delegate()); | 23 synced_window_delegates.insert((*i)->synced_window_delegate()); |
24 } | 24 } |
25 return synced_window_delegates; | 25 return synced_window_delegates; |
26 } | 26 } |
27 | 27 |
28 // static | 28 // static |
29 const browser_sync::SyncedWindowDelegate* | 29 const browser_sync::SyncedWindowDelegate* |
30 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( | 30 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( |
31 SessionID::id_type id) { | 31 SessionID::id_type id) { |
32 return BrowserList::FindBrowserWithID(id)->synced_window_delegate(); | 32 Browser* browser = BrowserList::FindBrowserWithID(id); |
| 33 // In case we don't find the browser (e.g. for Developer Tools). |
| 34 return browser ? browser->synced_window_delegate() : NULL; |
33 } | 35 } |
34 | 36 |
35 // BrowserSyncedWindowDelegate implementations | 37 // BrowserSyncedWindowDelegate implementations |
36 | 38 |
37 BrowserSyncedWindowDelegate::BrowserSyncedWindowDelegate(Browser* browser) | 39 BrowserSyncedWindowDelegate::BrowserSyncedWindowDelegate(Browser* browser) |
38 : browser_(browser) {} | 40 : browser_(browser) {} |
39 | 41 |
40 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} | 42 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} |
41 | 43 |
42 bool BrowserSyncedWindowDelegate::IsTabContentsWrapperPinned( | 44 bool BrowserSyncedWindowDelegate::IsTabContentsWrapperPinned( |
(...skipping 28 matching lines...) Expand all Loading... |
71 return browser_->is_app(); | 73 return browser_->is_app(); |
72 } | 74 } |
73 | 75 |
74 bool BrowserSyncedWindowDelegate::IsTypeTabbed() const { | 76 bool BrowserSyncedWindowDelegate::IsTypeTabbed() const { |
75 return browser_->is_type_tabbed(); | 77 return browser_->is_type_tabbed(); |
76 } | 78 } |
77 | 79 |
78 bool BrowserSyncedWindowDelegate::IsTypePopup() const { | 80 bool BrowserSyncedWindowDelegate::IsTypePopup() const { |
79 return browser_->is_type_popup(); | 81 return browser_->is_type_popup(); |
80 } | 82 } |
OLD | NEW |