| 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 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 5 #include "chrome/browser/ui/sync/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/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h" | 13 #include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h" |
| 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 | 16 |
| 16 // static SyncedWindowDelegate implementations | 17 // static SyncedWindowDelegate implementations |
| 17 | 18 |
| 18 // static | 19 // static |
| 19 const std::set<browser_sync::SyncedWindowDelegate*> | 20 const std::set<browser_sync::SyncedWindowDelegate*> |
| 20 browser_sync::SyncedWindowDelegate::GetSyncedWindowDelegates() { | 21 browser_sync::SyncedWindowDelegate::GetSyncedWindowDelegates() { |
| 21 std::set<browser_sync::SyncedWindowDelegate*> synced_window_delegates; | 22 std::set<browser_sync::SyncedWindowDelegate*> synced_window_delegates; |
| 22 for (BrowserList::const_iterator i = BrowserList::begin(); | 23 for (BrowserList::const_iterator i = BrowserList::begin(); |
| 23 i != BrowserList::end(); ++i) { | 24 i != BrowserList::end(); ++i) { |
| 24 synced_window_delegates.insert((*i)->synced_window_delegate()); | 25 synced_window_delegates.insert((*i)->synced_window_delegate()); |
| 25 } | 26 } |
| 26 return synced_window_delegates; | 27 return synced_window_delegates; |
| 27 } | 28 } |
| 28 | 29 |
| 29 // static | 30 // static |
| 30 const browser_sync::SyncedWindowDelegate* | 31 const browser_sync::SyncedWindowDelegate* |
| 31 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( | 32 browser_sync::SyncedWindowDelegate::FindSyncedWindowDelegateWithId( |
| 32 SessionID::id_type id) { | 33 SessionID::id_type id) { |
| 33 Browser* browser = BrowserList::FindBrowserWithID(id); | 34 Browser* browser = browser::FindBrowserWithID(id); |
| 34 // In case we don't find the browser (e.g. for Developer Tools). | 35 // In case we don't find the browser (e.g. for Developer Tools). |
| 35 return browser ? browser->synced_window_delegate() : NULL; | 36 return browser ? browser->synced_window_delegate() : NULL; |
| 36 } | 37 } |
| 37 | 38 |
| 38 // BrowserSyncedWindowDelegate implementations | 39 // BrowserSyncedWindowDelegate implementations |
| 39 | 40 |
| 40 BrowserSyncedWindowDelegate::BrowserSyncedWindowDelegate(Browser* browser) | 41 BrowserSyncedWindowDelegate::BrowserSyncedWindowDelegate(Browser* browser) |
| 41 : browser_(browser) {} | 42 : browser_(browser) {} |
| 42 | 43 |
| 43 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} | 44 BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {} |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return browser_->is_app(); | 84 return browser_->is_app(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 bool BrowserSyncedWindowDelegate::IsTypeTabbed() const { | 87 bool BrowserSyncedWindowDelegate::IsTypeTabbed() const { |
| 87 return browser_->is_type_tabbed(); | 88 return browser_->is_type_tabbed(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 bool BrowserSyncedWindowDelegate::IsTypePopup() const { | 91 bool BrowserSyncedWindowDelegate::IsTypePopup() const { |
| 91 return browser_->is_type_popup(); | 92 return browser_->is_type_popup(); |
| 92 } | 93 } |
| OLD | NEW |