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/tabs/tab_finder.h" | 5 #include "chrome/browser/tabs/tab_finder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
9 #include "chrome/browser/history/history.h" | 9 #include "chrome/browser/history/history.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 if (TabMatchesURL(selected_tab, url)) | 85 if (TabMatchesURL(selected_tab, url)) |
86 return NULL; | 86 return NULL; |
87 | 87 |
88 // See if the current browser has a tab matching the specified url. | 88 // See if the current browser has a tab matching the specified url. |
89 TabContents* tab_in_browser = FindTabInBrowser(browser, url); | 89 TabContents* tab_in_browser = FindTabInBrowser(browser, url); |
90 if (tab_in_browser) { | 90 if (tab_in_browser) { |
91 *existing_browser = browser; | 91 *existing_browser = browser; |
92 return tab_in_browser; | 92 return tab_in_browser; |
93 } | 93 } |
94 | 94 |
95 std::vector<Browser*> browsers = BrowserList::GetBrowsersWithProfile( | |
96 browser->profile()); | |
97 | |
95 // Then check other browsers. | 98 // Then check other browsers. |
96 for (BrowserList::const_iterator i = BrowserList::begin(); | 99 for (BrowserList::const_iterator i = browsers.begin(); |
97 i != BrowserList::end(); ++i) { | 100 i != browsers.end(); ++i) { |
98 if (!(*i)->profile()->IsOffTheRecord()) { | 101 if (!(*i)->profile()->IsOffTheRecord()) { |
jianli
2011/06/13 18:55:39
I think it will be simpler to check for the matchi
| |
99 tab_in_browser = FindTabInBrowser(*i, url); | 102 tab_in_browser = FindTabInBrowser(*i, url); |
100 if (tab_in_browser) { | 103 if (tab_in_browser) { |
101 *existing_browser = *i; | 104 *existing_browser = *i; |
102 return tab_in_browser; | 105 return tab_in_browser; |
103 } | 106 } |
104 } | 107 } |
105 } | 108 } |
106 | 109 |
107 return NULL; | 110 return NULL; |
108 } | 111 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 GURL url, | 237 GURL url, |
235 bool success, | 238 bool success, |
236 history::RedirectList* redirects) { | 239 history::RedirectList* redirects) { |
237 if (success && !redirects->empty()) { | 240 if (success && !redirects->empty()) { |
238 TabContents* tab_contents = | 241 TabContents* tab_contents = |
239 callback_consumer_.GetClientDataForCurrentRequest(); | 242 callback_consumer_.GetClientDataForCurrentRequest(); |
240 DCHECK(tab_contents); | 243 DCHECK(tab_contents); |
241 tab_contents_to_url_[tab_contents] = redirects->back(); | 244 tab_contents_to_url_[tab_contents] = redirects->back(); |
242 } | 245 } |
243 } | 246 } |
OLD | NEW |