Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/views/tabs/browser_tab_strip_controller.h" 5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_tab_helper.h" 10 #include "chrome/browser/extensions/extension_tab_helper.h"
11 #include "chrome/browser/favicon/favicon_tab_helper.h" 11 #include "chrome/browser/favicon/favicon_tab_helper.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_tabstrip.h"
15 #include "chrome/browser/ui/search/search.h" 16 #include "chrome/browser/ui/search/search.h"
16 #include "chrome/browser/ui/search/search_delegate.h" 17 #include "chrome/browser/ui/search/search_delegate.h"
17 #include "chrome/browser/ui/search/search_model.h" 18 #include "chrome/browser/ui/search/search_model.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents.h" 19 #include "chrome/browser/ui/tab_contents/tab_contents.h"
19 #include "chrome/browser/ui/tabs/tab_menu_model.h" 20 #include "chrome/browser/ui/tabs/tab_menu_model.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/browser/ui/tabs/tab_strip_selection_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_selection_model.h"
22 #include "chrome/browser/ui/views/tabs/tab.h" 23 #include "chrome/browser/ui/views/tabs/tab.h"
23 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" 24 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h"
24 #include "chrome/browser/ui/views/tabs/tab_strip.h" 25 #include "chrome/browser/ui/views/tabs/tab_strip.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 441 }
441 442
442 //////////////////////////////////////////////////////////////////////////////// 443 ////////////////////////////////////////////////////////////////////////////////
443 // BrowserTabStripController, chrome::search::SearchModelObserver: 444 // BrowserTabStripController, chrome::search::SearchModelObserver:
444 445
445 void BrowserTabStripController::ModeChanged(const chrome::search::Mode& mode) { 446 void BrowserTabStripController::ModeChanged(const chrome::search::Mode& mode) {
446 // Mode has changed, set tab data based on new mode, which will trigger 447 // Mode has changed, set tab data based on new mode, which will trigger
447 // repainting of tab's background. 448 // repainting of tab's background.
448 int active_index = GetActiveIndex(); 449 int active_index = GetActiveIndex();
449 DCHECK_NE(active_index, -1); 450 DCHECK_NE(active_index, -1);
450 SetTabDataAt(browser_->GetTabContentsAt(active_index), active_index); 451 SetTabDataAt(chrome::GetTabContentsAt(browser_, active_index), active_index);
451 } 452 }
452 453
453 //////////////////////////////////////////////////////////////////////////////// 454 ////////////////////////////////////////////////////////////////////////////////
454 // BrowserTabStripController, chrome::search::ToolbarSearchAnimator::Observer: 455 // BrowserTabStripController, chrome::search::ToolbarSearchAnimator::Observer:
455 456
456 void BrowserTabStripController::OnToolbarBackgroundAnimatorProgressed() { 457 void BrowserTabStripController::OnToolbarBackgroundAnimatorProgressed() {
457 // We're fading in the tab background, set tab data based on new background 458 // We're fading in the tab background, set tab data based on new background
458 // state and possibly opacity value, which will trigger repainting of tab's 459 // state and possibly opacity value, which will trigger repainting of tab's
459 // background. 460 // background.
460 int active_index = GetActiveIndex(); 461 int active_index = GetActiveIndex();
461 DCHECK_NE(active_index, -1); 462 DCHECK_NE(active_index, -1);
462 SetTabDataAt(browser_->GetTabContentsAt(active_index), active_index); 463 SetTabDataAt(chrome::GetTabContentsAt(browser_, active_index), active_index);
463 } 464 }
464 465
465 void BrowserTabStripController::OnToolbarBackgroundAnimatorCanceled( 466 void BrowserTabStripController::OnToolbarBackgroundAnimatorCanceled(
466 TabContents* tab_contents) { 467 TabContents* tab_contents) {
467 // Fade in of tab background has been canceled, which can happen in 2 468 // Fade in of tab background has been canceled, which can happen in 2
468 // scenarios: 469 // scenarios:
469 // 1) a deactivated or detached or closing tab, whose |tab_contents| is the 470 // 1) a deactivated or detached or closing tab, whose |tab_contents| is the
470 // the formal parameter: make sure |tab_contents| still exist in tab model. 471 // the formal parameter: make sure |tab_contents| still exist in tab model.
471 // 2) mode change of active tab, as indicated by a NULL |tab_contents|: make 472 // 2) mode change of active tab, as indicated by a NULL |tab_contents|: make
472 // sure active tab exists, and retrieve its |tab_contents|. 473 // sure active tab exists, and retrieve its |tab_contents|.
473 // If we proceed, set tab data so that |TabRendererData::background_state| and 474 // If we proceed, set tab data so that |TabRendererData::background_state| and
474 // |TabRendererData::search_background_opacity| will be reset. 475 // |TabRendererData::search_background_opacity| will be reset.
475 // Repainting of tab's background will be triggered in the process. 476 // Repainting of tab's background will be triggered in the process.
476 int index = tab_contents ? model_->GetIndexOfTabContents(tab_contents) : 477 int index = tab_contents ? model_->GetIndexOfTabContents(tab_contents) :
477 GetActiveIndex(); 478 GetActiveIndex();
478 if (index == -1) 479 if (index == -1)
479 return; 480 return;
480 SetTabDataAt(tab_contents ? tab_contents : browser_->GetTabContentsAt(index), 481 SetTabDataAt(tab_contents ? tab_contents :
481 index); 482 chrome::GetTabContentsAt(browser_, index), index);
482 } 483 }
483 484
484 //////////////////////////////////////////////////////////////////////////////// 485 ////////////////////////////////////////////////////////////////////////////////
485 // BrowserTabStripController, content::NotificationObserver implementation: 486 // BrowserTabStripController, content::NotificationObserver implementation:
486 487
487 void BrowserTabStripController::Observe(int type, 488 void BrowserTabStripController::Observe(int type,
488 const content::NotificationSource& source, 489 const content::NotificationSource& source,
489 const content::NotificationDetails& details) { 490 const content::NotificationDetails& details) {
490 switch (type) { 491 switch (type) {
491 case chrome::NOTIFICATION_PREF_CHANGED: 492 case chrome::NOTIFICATION_PREF_CHANGED:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB); 585 SetTabRendererDataFromModel(contents->web_contents(), index, &data, NEW_TAB);
585 tabstrip_->AddTabAt(index, data, is_active); 586 tabstrip_->AddTabAt(index, data, is_active);
586 } 587 }
587 588
588 void BrowserTabStripController::UpdateLayoutType() { 589 void BrowserTabStripController::UpdateLayoutType() {
589 bool adjust_layout = false; 590 bool adjust_layout = false;
590 TabStripLayoutType layout_type = 591 TabStripLayoutType layout_type =
591 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout); 592 DetermineTabStripLayout(g_browser_process->local_state(), &adjust_layout);
592 tabstrip_->SetLayoutType(layout_type, adjust_layout); 593 tabstrip_->SetLayoutType(layout_type, adjust_layout);
593 } 594 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tab_contents/render_view_context_menu_win.cc ('k') | chrome/browser/ui/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698