| 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/browser_finder.h" | 5 #include "chrome/browser/ui/browser_finder.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser_iterator.h" | 8 #include "chrome/browser/ui/browser_iterator.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (!window) | 151 if (!window) |
| 152 return NULL; | 152 return NULL; |
| 153 for (BrowserIterator it; !it.done(); it.Next()) { | 153 for (BrowserIterator it; !it.done(); it.Next()) { |
| 154 Browser* browser = *it; | 154 Browser* browser = *it; |
| 155 if (browser->window() && browser->window()->GetNativeWindow() == window) | 155 if (browser->window() && browser->window()->GetNativeWindow() == window) |
| 156 return browser; | 156 return browser; |
| 157 } | 157 } |
| 158 return NULL; | 158 return NULL; |
| 159 } | 159 } |
| 160 | 160 |
| 161 gfx::NativeWindow FindWindowForBrowser(Browser* browser) { |
| 162 if (browser && browser->window()) |
| 163 return browser->window()->GetNativeWindow(); |
| 164 return NULL; |
| 165 } |
| 166 |
| 161 Browser* FindBrowserWithWebContents(const WebContents* web_contents) { | 167 Browser* FindBrowserWithWebContents(const WebContents* web_contents) { |
| 162 DCHECK(web_contents); | 168 DCHECK(web_contents); |
| 163 for (TabContentsIterator it; !it.done(); it.Next()) { | 169 for (TabContentsIterator it; !it.done(); it.Next()) { |
| 164 if (*it == web_contents) | 170 if (*it == web_contents) |
| 165 return it.browser(); | 171 return it.browser(); |
| 166 } | 172 } |
| 167 return NULL; | 173 return NULL; |
| 168 } | 174 } |
| 169 | 175 |
| 170 Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type) { | 176 Browser* FindLastActiveWithProfile(Profile* profile, HostDesktopType type) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 208 |
| 203 size_t GetBrowserCount(Profile* profile, HostDesktopType type) { | 209 size_t GetBrowserCount(Profile* profile, HostDesktopType type) { |
| 204 return GetBrowserCountImpl(profile, type, kMatchAny); | 210 return GetBrowserCountImpl(profile, type, kMatchAny); |
| 205 } | 211 } |
| 206 | 212 |
| 207 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) { | 213 size_t GetTabbedBrowserCount(Profile* profile, HostDesktopType type) { |
| 208 return GetBrowserCountImpl(profile, type, kMatchTabbed); | 214 return GetBrowserCountImpl(profile, type, kMatchTabbed); |
| 209 } | 215 } |
| 210 | 216 |
| 211 } // namespace chrome | 217 } // namespace chrome |
| OLD | NEW |