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/tabs/tab_strip_model.h" | 5 #include "chrome/browser/tabs/tab_strip_model.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void set_can_close(bool value) { can_close_ = value; } | 90 void set_can_close(bool value) { can_close_ = value; } |
91 void set_run_unload_listener(bool value) { run_unload_ = value; } | 91 void set_run_unload_listener(bool value) { run_unload_ = value; } |
92 | 92 |
93 // Overridden from TabStripModelDelegate: | 93 // Overridden from TabStripModelDelegate: |
94 virtual TabContentsWrapper* CreateTabContentsForURL( | 94 virtual TabContentsWrapper* CreateTabContentsForURL( |
95 const GURL& url, | 95 const GURL& url, |
96 const content::Referrer& referrer, | 96 const content::Referrer& referrer, |
97 Profile* profile, | 97 Profile* profile, |
98 content::PageTransition transition, | 98 content::PageTransition transition, |
99 bool defer_load, | 99 bool defer_load, |
100 SiteInstance* instance) const OVERRIDE { | 100 content::SiteInstance* instance) const OVERRIDE { |
101 if (url == GURL(chrome::kChromeUINewTabURL)) | 101 if (url == GURL(chrome::kChromeUINewTabURL)) |
102 return dummy_contents_; | 102 return dummy_contents_; |
103 return NULL; | 103 return NULL; |
104 } | 104 } |
105 virtual bool RunUnloadListenerBeforeClosing( | 105 virtual bool RunUnloadListenerBeforeClosing( |
106 TabContentsWrapper* contents) OVERRIDE { | 106 TabContentsWrapper* contents) OVERRIDE { |
107 return run_unload_; | 107 return run_unload_; |
108 } | 108 } |
109 virtual bool CanCloseContents(std::vector<int>* indices) OVERRIDE { | 109 virtual bool CanCloseContents(std::vector<int>* indices) OVERRIDE { |
110 if (!can_close_) | 110 if (!can_close_) |
(...skipping 2247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 ASSERT_EQ(1, observer.GetStateCount()); | 2358 ASSERT_EQ(1, observer.GetStateCount()); |
2359 MockTabStripModelObserver::State s( | 2359 MockTabStripModelObserver::State s( |
2360 contents2, 1, MockTabStripModelObserver::SELECT); | 2360 contents2, 1, MockTabStripModelObserver::SELECT); |
2361 s.src_contents = contents2; | 2361 s.src_contents = contents2; |
2362 s.src_index = 1; | 2362 s.src_index = 1; |
2363 s.user_gesture = false; | 2363 s.user_gesture = false; |
2364 EXPECT_TRUE(observer.StateEquals(0, s)); | 2364 EXPECT_TRUE(observer.StateEquals(0, s)); |
2365 strip.RemoveObserver(&observer); | 2365 strip.RemoveObserver(&observer); |
2366 strip.CloseAllTabs(); | 2366 strip.CloseAllTabs(); |
2367 } | 2367 } |
OLD | NEW |