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/tabs/pinned_tab_service.h" | 5 #include "chrome/browser/ui/tabs/pinned_tab_service.h" |
6 | 6 |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_iterator.h" | 10 #include "chrome/browser/ui/browser_list.h" |
11 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" | 11 #include "chrome/browser/ui/tabs/pinned_tab_codec.h" |
12 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Returns true if |browser| is the only normal (tabbed) browser for |browser|'s | 16 // Returns true if |browser| is the only normal (tabbed) browser for |browser|'s |
17 // profile (across all desktops). | 17 // profile (across all desktops). |
18 bool IsOnlyNormalBrowser(Browser* browser) { | 18 bool IsOnlyNormalBrowser(Browser* browser) { |
19 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 19 for (auto* b : *BrowserList::GetInstance()) { |
20 if (*it != browser && it->is_type_tabbed() && | 20 if (b != browser && b->is_type_tabbed() && |
21 it->profile() == browser->profile()) { | 21 b->profile() == browser->profile()) { |
22 return false; | 22 return false; |
23 } | 23 } |
24 } | 24 } |
25 return true; | 25 return true; |
26 } | 26 } |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 PinnedTabService::PinnedTabService(Profile* profile) | 30 PinnedTabService::PinnedTabService(Profile* profile) |
31 : profile_(profile), | 31 : profile_(profile), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 PinnedTabCodec::WritePinnedTabs(profile_); | 94 PinnedTabCodec::WritePinnedTabs(profile_); |
95 save_pinned_tabs_ = false; | 95 save_pinned_tabs_ = false; |
96 } | 96 } |
97 break; | 97 break; |
98 } | 98 } |
99 | 99 |
100 default: | 100 default: |
101 NOTREACHED(); | 101 NOTREACHED(); |
102 } | 102 } |
103 } | 103 } |
OLD | NEW |