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/tab_strip_model.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 private: | 64 private: |
65 class DeletionObserver : public content::WebContentsObserver { | 65 class DeletionObserver : public content::WebContentsObserver { |
66 public: | 66 public: |
67 DeletionObserver(CloseTracker* parent, WebContents* web_contents) | 67 DeletionObserver(CloseTracker* parent, WebContents* web_contents) |
68 : WebContentsObserver(web_contents), | 68 : WebContentsObserver(web_contents), |
69 parent_(parent) { | 69 parent_(parent) { |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 // WebContentsObserver: | 73 // WebContentsObserver: |
74 virtual void WebContentsDestroyed() OVERRIDE { | 74 virtual void WebContentsDestroyed() override { |
75 parent_->OnWebContentsDestroyed(this); | 75 parent_->OnWebContentsDestroyed(this); |
76 } | 76 } |
77 | 77 |
78 CloseTracker* parent_; | 78 CloseTracker* parent_; |
79 | 79 |
80 DISALLOW_COPY_AND_ASSIGN(DeletionObserver); | 80 DISALLOW_COPY_AND_ASSIGN(DeletionObserver); |
81 }; | 81 }; |
82 | 82 |
83 void OnWebContentsDestroyed(DeletionObserver* observer); | 83 void OnWebContentsDestroyed(DeletionObserver* observer); |
84 | 84 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool pinned() const { return pinned_; } | 152 bool pinned() const { return pinned_; } |
153 void set_pinned(bool value) { pinned_ = value; } | 153 void set_pinned(bool value) { pinned_ = value; } |
154 bool blocked() const { return blocked_; } | 154 bool blocked() const { return blocked_; } |
155 void set_blocked(bool value) { blocked_ = value; } | 155 void set_blocked(bool value) { blocked_ = value; } |
156 bool discarded() const { return discarded_; } | 156 bool discarded() const { return discarded_; } |
157 void set_discarded(bool value) { discarded_ = value; } | 157 void set_discarded(bool value) { discarded_ = value; } |
158 | 158 |
159 private: | 159 private: |
160 // Make sure that if someone deletes this WebContents out from under us, it | 160 // Make sure that if someone deletes this WebContents out from under us, it |
161 // is properly removed from the tab strip. | 161 // is properly removed from the tab strip. |
162 virtual void WebContentsDestroyed() OVERRIDE; | 162 virtual void WebContentsDestroyed() override; |
163 | 163 |
164 // The WebContents being tracked by this WebContentsData. The | 164 // The WebContents being tracked by this WebContentsData. The |
165 // WebContentsObserver does keep a reference, but when the WebContents is | 165 // WebContentsObserver does keep a reference, but when the WebContents is |
166 // deleted, the WebContentsObserver reference is NULLed and thus inaccessible. | 166 // deleted, the WebContentsObserver reference is NULLed and thus inaccessible. |
167 WebContents* contents_; | 167 WebContents* contents_; |
168 | 168 |
169 // The TabStripModel containing this WebContents. | 169 // The TabStripModel containing this WebContents. |
170 TabStripModel* tab_strip_model_; | 170 TabStripModel* tab_strip_model_; |
171 | 171 |
172 // The group is used to model a set of tabs spawned from a single parent | 172 // The group is used to model a set of tabs spawned from a single parent |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 void TabStripModel::ForgetOpenersAndGroupsReferencing( | 1429 void TabStripModel::ForgetOpenersAndGroupsReferencing( |
1430 const WebContents* tab) { | 1430 const WebContents* tab) { |
1431 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); | 1431 for (WebContentsDataVector::const_iterator i = contents_data_.begin(); |
1432 i != contents_data_.end(); ++i) { | 1432 i != contents_data_.end(); ++i) { |
1433 if ((*i)->group() == tab) | 1433 if ((*i)->group() == tab) |
1434 (*i)->set_group(NULL); | 1434 (*i)->set_group(NULL); |
1435 if ((*i)->opener() == tab) | 1435 if ((*i)->opener() == tab) |
1436 (*i)->set_opener(NULL); | 1436 (*i)->set_opener(NULL); |
1437 } | 1437 } |
1438 } | 1438 } |
OLD | NEW |