| 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_strip_model.h" | 5 #include "chrome/browser/tabs/tab_strip_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
| 26 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
| 27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 28 #include "content/browser/renderer_host/render_process_host.h" | 28 #include "content/browser/renderer_host/render_process_host.h" |
| 29 #include "content/browser/tab_contents/navigation_controller.h" | 29 #include "content/browser/tab_contents/navigation_controller.h" |
| 30 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
| 31 #include "content/browser/tab_contents/tab_contents_delegate.h" | 31 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 32 #include "content/browser/tab_contents/tab_contents_view.h" | 32 #include "content/browser/tab_contents/tab_contents_view.h" |
| 33 #include "content/browser/user_metrics.h" | 33 #include "content/browser/user_metrics.h" |
| 34 #include "content/common/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // Returns true if the specified transition is one of the types that cause the | 38 // Returns true if the specified transition is one of the types that cause the |
| 39 // opener relationships for the tab in which the transition occured to be | 39 // opener relationships for the tab in which the transition occured to be |
| 40 // forgotten. This is generally any navigation that isn't a link click (i.e. | 40 // forgotten. This is generally any navigation that isn't a link click (i.e. |
| 41 // any navigation that can be considered to be the start of a new task distinct | 41 // any navigation that can be considered to be the start of a new task distinct |
| 42 // from what had previously occurred in that tab). | 42 // from what had previously occurred in that tab). |
| 43 bool ShouldForgetOpenersForTransition(content::PageTransition transition) { | 43 bool ShouldForgetOpenersForTransition(content::PageTransition transition) { |
| 44 return transition == content::PAGE_TRANSITION_TYPED || | 44 return transition == content::PAGE_TRANSITION_TYPED || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 61 // TabStripModel, public: | 61 // TabStripModel, public: |
| 62 | 62 |
| 63 TabStripModel::TabStripModel(TabStripModelDelegate* delegate, Profile* profile) | 63 TabStripModel::TabStripModel(TabStripModelDelegate* delegate, Profile* profile) |
| 64 : delegate_(delegate), | 64 : delegate_(delegate), |
| 65 profile_(profile), | 65 profile_(profile), |
| 66 closing_all_(false), | 66 closing_all_(false), |
| 67 order_controller_(NULL) { | 67 order_controller_(NULL) { |
| 68 DCHECK(delegate_); | 68 DCHECK(delegate_); |
| 69 registrar_.Add(this, | 69 registrar_.Add(this, |
| 70 content::NOTIFICATION_TAB_CONTENTS_DESTROYED, | 70 content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
| 71 NotificationService::AllBrowserContextsAndSources()); | 71 content::NotificationService::AllBrowserContextsAndSources()); |
| 72 registrar_.Add(this, | 72 registrar_.Add(this, |
| 73 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 73 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 74 content::Source<Profile>(profile_)); | 74 content::Source<Profile>(profile_)); |
| 75 order_controller_ = new TabStripModelOrderController(this); | 75 order_controller_ = new TabStripModelOrderController(this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 TabStripModel::~TabStripModel() { | 78 TabStripModel::~TabStripModel() { |
| 79 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, | 79 FOR_EACH_OBSERVER(TabStripModelObserver, observers_, |
| 80 TabStripModelDeleted()); | 80 TabStripModelDeleted()); |
| 81 STLDeleteElements(&contents_data_); | 81 STLDeleteElements(&contents_data_); |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1318 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
| 1319 const NavigationController* tab) { | 1319 const NavigationController* tab) { |
| 1320 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); | 1320 for (TabContentsDataVector::const_iterator i = contents_data_.begin(); |
| 1321 i != contents_data_.end(); ++i) { | 1321 i != contents_data_.end(); ++i) { |
| 1322 if ((*i)->group == tab) | 1322 if ((*i)->group == tab) |
| 1323 (*i)->group = NULL; | 1323 (*i)->group = NULL; |
| 1324 if ((*i)->opener == tab) | 1324 if ((*i)->opener == tab) |
| 1325 (*i)->opener = NULL; | 1325 (*i)->opener = NULL; |
| 1326 } | 1326 } |
| 1327 } | 1327 } |
| OLD | NEW |