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 <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // When |source| is deleted both |tab_to_delete| and |tab_strip| are deleted. | 51 // When |source| is deleted both |tab_to_delete| and |tab_strip| are deleted. |
52 // |tab_to_delete| and |tab_strip| may be NULL. | 52 // |tab_to_delete| and |tab_strip| may be NULL. |
53 DeleteWebContentsOnDestroyedObserver(WebContents* source, | 53 DeleteWebContentsOnDestroyedObserver(WebContents* source, |
54 WebContents* tab_to_delete, | 54 WebContents* tab_to_delete, |
55 TabStripModel* tab_strip) | 55 TabStripModel* tab_strip) |
56 : WebContentsObserver(source), | 56 : WebContentsObserver(source), |
57 tab_to_delete_(tab_to_delete), | 57 tab_to_delete_(tab_to_delete), |
58 tab_strip_(tab_strip) { | 58 tab_strip_(tab_strip) { |
59 } | 59 } |
60 | 60 |
61 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE { | 61 virtual void WebContentsDestroyed() OVERRIDE { |
62 WebContents* tab_to_delete = tab_to_delete_; | 62 WebContents* tab_to_delete = tab_to_delete_; |
63 tab_to_delete_ = NULL; | 63 tab_to_delete_ = NULL; |
64 TabStripModel* tab_strip_to_delete = tab_strip_; | 64 TabStripModel* tab_strip_to_delete = tab_strip_; |
65 tab_strip_ = NULL; | 65 tab_strip_ = NULL; |
66 delete tab_to_delete; | 66 delete tab_to_delete; |
67 delete tab_strip_to_delete; | 67 delete tab_strip_to_delete; |
68 } | 68 } |
69 | 69 |
70 private: | 70 private: |
71 WebContents* tab_to_delete_; | 71 WebContents* tab_to_delete_; |
(...skipping 2511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 WebContents* moved_contents = strip_src.DetachWebContentsAt(1); | 2583 WebContents* moved_contents = strip_src.DetachWebContentsAt(1); |
2584 EXPECT_EQ(contents2, moved_contents); | 2584 EXPECT_EQ(contents2, moved_contents); |
2585 | 2585 |
2586 // Attach the tab to the destination tab strip. | 2586 // Attach the tab to the destination tab strip. |
2587 strip_dst.AppendWebContents(moved_contents, true); | 2587 strip_dst.AppendWebContents(moved_contents, true); |
2588 EXPECT_TRUE(strip_dst.IsTabBlocked(0)); | 2588 EXPECT_TRUE(strip_dst.IsTabBlocked(0)); |
2589 | 2589 |
2590 strip_dst.CloseAllTabs(); | 2590 strip_dst.CloseAllTabs(); |
2591 strip_src.CloseAllTabs(); | 2591 strip_src.CloseAllTabs(); |
2592 } | 2592 } |
OLD | NEW |