| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 : tab_strip_model_(tab_strip_model) { | 142 : tab_strip_model_(tab_strip_model) { |
| 143 tab_strip_model_->AddObserver(this); | 143 tab_strip_model_->AddObserver(this); |
| 144 } | 144 } |
| 145 | 145 |
| 146 ~TabBlockedStateTestBrowser() override { | 146 ~TabBlockedStateTestBrowser() override { |
| 147 tab_strip_model_->RemoveObserver(this); | 147 tab_strip_model_->RemoveObserver(this); |
| 148 } | 148 } |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 // TabStripModelObserver | 151 // TabStripModelObserver |
| 152 void TabInsertedAt(WebContents* contents, | 152 void TabInsertedAt(TabStripModel* tab_strip_model, |
| 153 WebContents* contents, |
| 153 int index, | 154 int index, |
| 154 bool foreground) override { | 155 bool foreground) override { |
| 155 web_modal::WebContentsModalDialogManager* manager = | 156 web_modal::WebContentsModalDialogManager* manager = |
| 156 web_modal::WebContentsModalDialogManager::FromWebContents(contents); | 157 web_modal::WebContentsModalDialogManager::FromWebContents(contents); |
| 157 if (manager) | 158 if (manager) |
| 158 manager->SetDelegate(this); | 159 manager->SetDelegate(this); |
| 159 } | 160 } |
| 160 | 161 |
| 161 // WebContentsModalDialogManagerDelegate | 162 // WebContentsModalDialogManagerDelegate |
| 162 void SetWebContentsBlocked(content::WebContents* contents, | 163 void SetWebContentsBlocked(content::WebContents* contents, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 states_.push_back(State(contents, index, CHANGE)); | 395 states_.push_back(State(contents, index, CHANGE)); |
| 395 } | 396 } |
| 396 void TabReplacedAt(TabStripModel* tab_strip_model, | 397 void TabReplacedAt(TabStripModel* tab_strip_model, |
| 397 WebContents* old_contents, | 398 WebContents* old_contents, |
| 398 WebContents* new_contents, | 399 WebContents* new_contents, |
| 399 int index) override { | 400 int index) override { |
| 400 State s(new_contents, index, REPLACED); | 401 State s(new_contents, index, REPLACED); |
| 401 s.src_contents = old_contents; | 402 s.src_contents = old_contents; |
| 402 states_.push_back(s); | 403 states_.push_back(s); |
| 403 } | 404 } |
| 404 void TabPinnedStateChanged(WebContents* contents, int index) override { | 405 void TabPinnedStateChanged(TabStripModel* tab_strip_model, |
| 406 WebContents* contents, |
| 407 int index) override { |
| 405 states_.push_back(State(contents, index, PINNED)); | 408 states_.push_back(State(contents, index, PINNED)); |
| 406 } | 409 } |
| 407 void TabStripEmpty() override { empty_ = true; } | 410 void TabStripEmpty() override { empty_ = true; } |
| 408 void WillCloseAllTabs() override { | 411 void WillCloseAllTabs() override { |
| 409 states_.push_back(State(NULL, -1, CLOSE_ALL)); | 412 states_.push_back(State(NULL, -1, CLOSE_ALL)); |
| 410 } | 413 } |
| 411 void CloseAllTabsCanceled() override { | 414 void CloseAllTabsCanceled() override { |
| 412 states_.push_back(State(NULL, -1, CLOSE_ALL_CANCELED)); | 415 states_.push_back(State(NULL, -1, CLOSE_ALL_CANCELED)); |
| 413 } | 416 } |
| 414 | 417 |
| (...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2540 strip.AddObserver(&observer); | 2543 strip.AddObserver(&observer); |
| 2541 | 2544 |
| 2542 strip.ActivateTabAt(1, true); | 2545 strip.ActivateTabAt(1, true); |
| 2543 EXPECT_EQ(1, strip.active_index()); | 2546 EXPECT_EQ(1, strip.active_index()); |
| 2544 | 2547 |
| 2545 strip.MoveWebContentsAt(2, 3, true); | 2548 strip.MoveWebContentsAt(2, 3, true); |
| 2546 EXPECT_EQ(3, strip.active_index()); | 2549 EXPECT_EQ(3, strip.active_index()); |
| 2547 | 2550 |
| 2548 strip.CloseAllTabs(); | 2551 strip.CloseAllTabs(); |
| 2549 } | 2552 } |
| OLD | NEW |