| 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 "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 UpdateSidebarForContents(NULL); | 1433 UpdateSidebarForContents(NULL); |
| 1434 UpdateDevToolsForContents(NULL); | 1434 UpdateDevToolsForContents(NULL); |
| 1435 } | 1435 } |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 void BrowserView::TabDeactivated(TabContentsWrapper* contents) { | 1438 void BrowserView::TabDeactivated(TabContentsWrapper* contents) { |
| 1439 // We do not store the focus when closing the tab to work-around bug 4633. | 1439 // We do not store the focus when closing the tab to work-around bug 4633. |
| 1440 // Some reports seem to show that the focus manager and/or focused view can | 1440 // Some reports seem to show that the focus manager and/or focused view can |
| 1441 // be garbage at that point, it is not clear why. | 1441 // be garbage at that point, it is not clear why. |
| 1442 if (!contents->tab_contents()->is_being_destroyed()) | 1442 if (!contents->tab_contents()->is_being_destroyed()) |
| 1443 contents->view()->StoreFocus(); | 1443 contents->tab_contents()->view()->StoreFocus(); |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 void BrowserView::ActiveTabChanged(TabContentsWrapper* old_contents, | 1446 void BrowserView::ActiveTabChanged(TabContentsWrapper* old_contents, |
| 1447 TabContentsWrapper* new_contents, | 1447 TabContentsWrapper* new_contents, |
| 1448 int index, | 1448 int index, |
| 1449 bool user_gesture) { | 1449 bool user_gesture) { |
| 1450 ProcessTabSelected(new_contents); | 1450 ProcessTabSelected(new_contents); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 void BrowserView::TabReplacedAt(TabStripModel* tab_strip_model, | 1453 void BrowserView::TabReplacedAt(TabStripModel* tab_strip_model, |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 UpdateDevToolsForContents(new_contents); | 2601 UpdateDevToolsForContents(new_contents); |
| 2602 // TODO(beng): This should be called automatically by ChangeTabContents, but I | 2602 // TODO(beng): This should be called automatically by ChangeTabContents, but I |
| 2603 // am striving for parity now rather than cleanliness. This is | 2603 // am striving for parity now rather than cleanliness. This is |
| 2604 // required to make features like Duplicate Tab, Undo Close Tab, | 2604 // required to make features like Duplicate Tab, Undo Close Tab, |
| 2605 // etc not result in sad tab. | 2605 // etc not result in sad tab. |
| 2606 new_contents->tab_contents()->DidBecomeSelected(); | 2606 new_contents->tab_contents()->DidBecomeSelected(); |
| 2607 if (BrowserList::GetLastActive() == browser_ && | 2607 if (BrowserList::GetLastActive() == browser_ && |
| 2608 !browser_->tabstrip_model()->closing_all() && GetWidget()->IsVisible()) { | 2608 !browser_->tabstrip_model()->closing_all() && GetWidget()->IsVisible()) { |
| 2609 // We only restore focus if our window is visible, to avoid invoking blur | 2609 // We only restore focus if our window is visible, to avoid invoking blur |
| 2610 // handlers when we are eventually shown. | 2610 // handlers when we are eventually shown. |
| 2611 new_contents->view()->RestoreFocus(); | 2611 new_contents->tab_contents()->view()->RestoreFocus(); |
| 2612 } | 2612 } |
| 2613 | 2613 |
| 2614 // Update all the UI bits. | 2614 // Update all the UI bits. |
| 2615 UpdateTitleBar(); | 2615 UpdateTitleBar(); |
| 2616 // No need to update Toolbar because it's already updated in | 2616 // No need to update Toolbar because it's already updated in |
| 2617 // browser.cc. | 2617 // browser.cc. |
| 2618 } | 2618 } |
| 2619 | 2619 |
| 2620 gfx::Size BrowserView::GetResizeCornerSize() const { | 2620 gfx::Size BrowserView::GetResizeCornerSize() const { |
| 2621 return ResizeCorner::GetSize(); | 2621 return ResizeCorner::GetSize(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 browser::CreateViewsBubble(bubble); | 2657 browser::CreateViewsBubble(bubble); |
| 2658 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 2658 bubble->SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
| 2659 bubble->Show(); | 2659 bubble->Show(); |
| 2660 } | 2660 } |
| 2661 | 2661 |
| 2662 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2662 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
| 2663 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2663 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
| 2664 if (button) | 2664 if (button) |
| 2665 button->ShowAvatarBubble(); | 2665 button->ShowAvatarBubble(); |
| 2666 } | 2666 } |
| OLD | NEW |