OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/wm_overview_controller.h" | 5 #include "chrome/browser/chromeos/wm_overview_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/linked_ptr.h" | 10 #include "base/linked_ptr.h" |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 | 637 |
638 // Iterator through the browser list, adding all the browsers in the | 638 // Iterator through the browser list, adding all the browsers in the |
639 // new order. If they were in the old list of listeners, just copy | 639 // new order. If they were in the old list of listeners, just copy |
640 // that linked pointer, instead of making a new listener, so that we | 640 // that linked pointer, instead of making a new listener, so that we |
641 // can avoid lots of spurious destroy/create messages. | 641 // can avoid lots of spurious destroy/create messages. |
642 BrowserList::const_iterator iterator = BrowserList::begin(); | 642 BrowserList::const_iterator iterator = BrowserList::begin(); |
643 while (iterator != BrowserList::end()) { | 643 while (iterator != BrowserList::end()) { |
644 // Don't add a browser to the list if that type of browser doesn't | 644 // Don't add a browser to the list if that type of browser doesn't |
645 // have snapshots in overview mode. | 645 // have snapshots in overview mode. |
646 if ((*iterator)->type() != Browser::TYPE_NORMAL && | 646 if ((*iterator)->type() != Browser::TYPE_NORMAL && |
647 (*iterator)->type() != Browser::TYPE_APP && | 647 (*iterator)->type() != Browser::TYPE_APP) { |
648 (*iterator)->type() != Browser::TYPE_EXTENSION_APP) { | |
649 ++iterator; | 648 ++iterator; |
650 continue; | 649 continue; |
651 } | 650 } |
652 | 651 |
653 BrowserListenerVector::value_type item( | 652 BrowserListenerVector::value_type item( |
654 BrowserListenerVector::value_type(NULL)); | 653 BrowserListenerVector::value_type(NULL)); |
655 for (BrowserListenerVector::iterator old_iter = old_listeners.begin(); | 654 for (BrowserListenerVector::iterator old_iter = old_listeners.begin(); |
656 old_iter != old_listeners.end(); ++old_iter) { | 655 old_iter != old_listeners.end(); ++old_iter) { |
657 if ((*old_iter)->browser() == *iterator) { | 656 if ((*old_iter)->browser() == *iterator) { |
658 item = *old_iter; | 657 item = *old_iter; |
659 break; | 658 break; |
660 } | 659 } |
661 } | 660 } |
662 | 661 |
663 // This browser isn't tracked by any listener, so create it. | 662 // This browser isn't tracked by any listener, so create it. |
664 if (item.get() == NULL) { | 663 if (item.get() == NULL) { |
665 item = BrowserListenerVector::value_type( | 664 item = BrowserListenerVector::value_type( |
666 new BrowserListener(*iterator, this)); | 665 new BrowserListener(*iterator, this)); |
667 } | 666 } |
668 listeners_.push_back(item); | 667 listeners_.push_back(item); |
669 ++iterator; | 668 ++iterator; |
670 } | 669 } |
671 } | 670 } |
672 | 671 |
673 } // namespace chromeos | 672 } // namespace chromeos |
OLD | NEW |