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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 namespace { | 45 namespace { |
46 | 46 |
47 // Class used to delete a TabContents when another TabContents is destroyed. | 47 // Class used to delete a TabContents when another TabContents is destroyed. |
48 class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { | 48 class DeleteTabContentsOnDestroyedObserver : public NotificationObserver { |
49 public: | 49 public: |
50 DeleteTabContentsOnDestroyedObserver(TabContentsWrapper* source, | 50 DeleteTabContentsOnDestroyedObserver(TabContentsWrapper* source, |
51 TabContentsWrapper* tab_to_delete) | 51 TabContentsWrapper* tab_to_delete) |
52 : source_(source), | 52 : source_(source), |
53 tab_to_delete_(tab_to_delete) { | 53 tab_to_delete_(tab_to_delete) { |
54 registrar_.Add(this, | 54 registrar_.Add(this, |
55 NotificationType::TAB_CONTENTS_DESTROYED, | 55 content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
56 Source<TabContents>(source->tab_contents())); | 56 Source<TabContents>(source->tab_contents())); |
57 } | 57 } |
58 | 58 |
59 virtual void Observe(NotificationType type, | 59 virtual void Observe(int type, |
60 const NotificationSource& source, | 60 const NotificationSource& source, |
61 const NotificationDetails& details) { | 61 const NotificationDetails& details) { |
62 TabContentsWrapper* tab_to_delete = tab_to_delete_; | 62 TabContentsWrapper* tab_to_delete = tab_to_delete_; |
63 tab_to_delete_ = NULL; | 63 tab_to_delete_ = NULL; |
64 delete tab_to_delete; | 64 delete tab_to_delete; |
65 } | 65 } |
66 | 66 |
67 private: | 67 private: |
68 TabContentsWrapper* source_; | 68 TabContentsWrapper* source_; |
69 TabContentsWrapper* tab_to_delete_; | 69 TabContentsWrapper* tab_to_delete_; |
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 ASSERT_EQ(1, observer.GetStateCount()); | 2323 ASSERT_EQ(1, observer.GetStateCount()); |
2324 MockTabStripModelObserver::State s( | 2324 MockTabStripModelObserver::State s( |
2325 contents2, 1, MockTabStripModelObserver::SELECT); | 2325 contents2, 1, MockTabStripModelObserver::SELECT); |
2326 s.src_contents = contents2; | 2326 s.src_contents = contents2; |
2327 s.src_index = 1; | 2327 s.src_index = 1; |
2328 s.user_gesture = false; | 2328 s.user_gesture = false; |
2329 EXPECT_TRUE(observer.StateEquals(0, s)); | 2329 EXPECT_TRUE(observer.StateEquals(0, s)); |
2330 strip.RemoveObserver(&observer); | 2330 strip.RemoveObserver(&observer); |
2331 strip.CloseAllTabs(); | 2331 strip.CloseAllTabs(); |
2332 } | 2332 } |
OLD | NEW |