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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 SetBounds(parent()->width() - ps.width(), | 285 SetBounds(parent()->width() - ps.width(), |
286 parent()->height() - ps.height(), ps.width(), ps.height()); | 286 parent()->height() - ps.height(), ps.width(), ps.height()); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 private: | 290 private: |
291 // Returns the WindowWin we're displayed in. Returns NULL if we're not | 291 // Returns the WindowWin we're displayed in. Returns NULL if we're not |
292 // currently in a window. | 292 // currently in a window. |
293 views::Window* GetWindow() { | 293 views::Window* GetWindow() { |
294 views::Widget* widget = GetWidget(); | 294 views::Widget* widget = GetWidget(); |
295 return widget ? widget->GetWindow() : NULL; | 295 return widget ? widget->GetContainingWindow() : NULL; |
296 } | 296 } |
297 | 297 |
298 DISALLOW_COPY_AND_ASSIGN(ResizeCorner); | 298 DISALLOW_COPY_AND_ASSIGN(ResizeCorner); |
299 }; | 299 }; |
300 | 300 |
301 /////////////////////////////////////////////////////////////////////////////// | 301 /////////////////////////////////////////////////////////////////////////////// |
302 // BrowserView, public: | 302 // BrowserView, public: |
303 | 303 |
304 BrowserView::BrowserView(Browser* browser) | 304 BrowserView::BrowserView(Browser* browser) |
305 : views::ClientView(NULL, NULL), | 305 : views::ClientView(NULL, NULL), |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // The same fix as in BrowserWindowGtk::Show. | 572 // The same fix as in BrowserWindowGtk::Show. |
573 // | 573 // |
574 // The Browser must become the active browser when Show() is called. | 574 // The Browser must become the active browser when Show() is called. |
575 // But, on Gtk, the browser won't be shown until we return to the runloop. | 575 // But, on Gtk, the browser won't be shown until we return to the runloop. |
576 // Therefore we need to set the active window here explicitly. otherwise | 576 // Therefore we need to set the active window here explicitly. otherwise |
577 // any calls to BrowserList::GetLastActive() (for example, in bookmark_util), | 577 // any calls to BrowserList::GetLastActive() (for example, in bookmark_util), |
578 // will return the previous browser. | 578 // will return the previous browser. |
579 BrowserList::SetLastActive(browser()); | 579 BrowserList::SetLastActive(browser()); |
580 | 580 |
581 // If the window is already visible, just activate it. | 581 // If the window is already visible, just activate it. |
582 if (frame_->GetWindow()->IsVisible()) { | 582 if (frame_->IsVisible()) { |
583 frame_->GetWindow()->Activate(); | 583 frame_->Activate(); |
584 return; | 584 return; |
585 } | 585 } |
586 | 586 |
587 // Setting the focus doesn't work when the window is invisible, so any focus | 587 // Setting the focus doesn't work when the window is invisible, so any focus |
588 // initialization that happened before this will be lost. | 588 // initialization that happened before this will be lost. |
589 // | 589 // |
590 // We really "should" restore the focus whenever the window becomes unhidden, | 590 // We really "should" restore the focus whenever the window becomes unhidden, |
591 // but I think initializing is the only time where this can happen where | 591 // but I think initializing is the only time where this can happen where |
592 // there is some focus change we need to pick up, and this is easier than | 592 // there is some focus change we need to pick up, and this is easier than |
593 // plumbing through an un-hide message all the way from the frame. | 593 // plumbing through an un-hide message all the way from the frame. |
594 // | 594 // |
595 // If we do find there are cases where we need to restore the focus on show, | 595 // If we do find there are cases where we need to restore the focus on show, |
596 // that should be added and this should be removed. | 596 // that should be added and this should be removed. |
597 RestoreFocus(); | 597 RestoreFocus(); |
598 | 598 |
599 frame_->GetWindow()->Show(); | 599 frame_->Show(); |
600 } | 600 } |
601 | 601 |
602 void BrowserView::ShowInactive() { | 602 void BrowserView::ShowInactive() { |
603 views::Window* window = frame_->GetWindow(); | 603 if (!frame_->IsVisible()) |
604 if (!window->IsVisible()) | 604 frame_->ShowInactive(); |
605 window->ShowInactive(); | |
606 } | 605 } |
607 | 606 |
608 void BrowserView::SetBounds(const gfx::Rect& bounds) { | 607 void BrowserView::SetBounds(const gfx::Rect& bounds) { |
609 SetFullscreen(false); | 608 SetFullscreen(false); |
610 GetWidget()->SetBounds(bounds); | 609 GetWidget()->SetBounds(bounds); |
611 } | 610 } |
612 | 611 |
613 void BrowserView::Close() { | 612 void BrowserView::Close() { |
614 BrowserBubbleHost::Close(); | 613 BrowserBubbleHost::Close(); |
615 | 614 |
616 frame_->GetWindow()->CloseWindow(); | 615 frame_->Close(); |
617 } | 616 } |
618 | 617 |
619 void BrowserView::Activate() { | 618 void BrowserView::Activate() { |
620 frame_->GetWindow()->Activate(); | 619 frame_->Activate(); |
621 } | 620 } |
622 | 621 |
623 void BrowserView::Deactivate() { | 622 void BrowserView::Deactivate() { |
624 frame_->GetWindow()->Deactivate(); | 623 frame_->Deactivate(); |
625 } | 624 } |
626 | 625 |
627 bool BrowserView::IsActive() const { | 626 bool BrowserView::IsActive() const { |
628 return frame_->GetWindow()->IsActive(); | 627 return frame_->IsActive(); |
629 } | 628 } |
630 | 629 |
631 void BrowserView::FlashFrame() { | 630 void BrowserView::FlashFrame() { |
632 #if defined(OS_WIN) | 631 #if defined(OS_WIN) |
633 FLASHWINFO fwi; | 632 FLASHWINFO fwi; |
634 fwi.cbSize = sizeof(fwi); | 633 fwi.cbSize = sizeof(fwi); |
635 fwi.hwnd = frame_->GetWindow()->GetNativeWindow(); | 634 fwi.hwnd = frame_->GetNativeWindow(); |
636 fwi.dwFlags = FLASHW_ALL; | 635 fwi.dwFlags = FLASHW_ALL; |
637 fwi.uCount = 4; | 636 fwi.uCount = 4; |
638 fwi.dwTimeout = 0; | 637 fwi.dwTimeout = 0; |
639 FlashWindowEx(&fwi); | 638 FlashWindowEx(&fwi); |
640 #else | 639 #else |
641 // Doesn't matter for chrome os. | 640 // Doesn't matter for chrome os. |
642 #endif | 641 #endif |
643 } | 642 } |
644 | 643 |
645 gfx::NativeWindow BrowserView::GetNativeHandle() { | 644 gfx::NativeWindow BrowserView::GetNativeHandle() { |
646 return GetWidget()->GetWindow()->GetNativeWindow(); | 645 return GetWidget()->GetContainingWindow()->GetNativeWindow(); |
647 } | 646 } |
648 | 647 |
649 BrowserWindowTesting* BrowserView::GetBrowserWindowTesting() { | 648 BrowserWindowTesting* BrowserView::GetBrowserWindowTesting() { |
650 return this; | 649 return this; |
651 } | 650 } |
652 | 651 |
653 StatusBubble* BrowserView::GetStatusBubble() { | 652 StatusBubble* BrowserView::GetStatusBubble() { |
654 return status_bubble_.get(); | 653 return status_bubble_.get(); |
655 } | 654 } |
656 | 655 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 // with a gray rect because the clip wasn't updated. Note that a reentrant | 700 // with a gray rect because the clip wasn't updated. Note that a reentrant |
702 // call never needs to do this, because after it returns, the normal call | 701 // call never needs to do this, because after it returns, the normal call |
703 // wrapping it will do it. | 702 // wrapping it will do it. |
704 if ((call_state == NORMAL) && !is_animating) { | 703 if ((call_state == NORMAL) && !is_animating) { |
705 contents_container_->InvalidateLayout(); | 704 contents_container_->InvalidateLayout(); |
706 contents_split_->Layout(); | 705 contents_split_->Layout(); |
707 } | 706 } |
708 } | 707 } |
709 | 708 |
710 void BrowserView::UpdateTitleBar() { | 709 void BrowserView::UpdateTitleBar() { |
711 frame_->GetWindow()->UpdateWindowTitle(); | 710 frame_->UpdateWindowTitle(); |
712 if (ShouldShowWindowIcon() && !loading_animation_timer_.IsRunning()) | 711 if (ShouldShowWindowIcon() && !loading_animation_timer_.IsRunning()) |
713 frame_->GetWindow()->UpdateWindowIcon(); | 712 frame_->UpdateWindowIcon(); |
714 } | 713 } |
715 | 714 |
716 void BrowserView::ShelfVisibilityChanged() { | 715 void BrowserView::ShelfVisibilityChanged() { |
717 Layout(); | 716 Layout(); |
718 } | 717 } |
719 | 718 |
720 void BrowserView::UpdateDevTools() { | 719 void BrowserView::UpdateDevTools() { |
721 UpdateDevToolsForContents(GetSelectedTabContentsWrapper()); | 720 UpdateDevToolsForContents(GetSelectedTabContentsWrapper()); |
722 Layout(); | 721 Layout(); |
723 } | 722 } |
(...skipping 15 matching lines...) Expand all Loading... |
739 LoadingAnimationCallback(); | 738 LoadingAnimationCallback(); |
740 } | 739 } |
741 } | 740 } |
742 } | 741 } |
743 | 742 |
744 void BrowserView::SetStarredState(bool is_starred) { | 743 void BrowserView::SetStarredState(bool is_starred) { |
745 GetLocationBarView()->SetStarToggled(is_starred); | 744 GetLocationBarView()->SetStarToggled(is_starred); |
746 } | 745 } |
747 | 746 |
748 gfx::Rect BrowserView::GetRestoredBounds() const { | 747 gfx::Rect BrowserView::GetRestoredBounds() const { |
749 return frame_->GetWindow()->GetNormalBounds(); | 748 return frame_->GetNormalBounds(); |
750 } | 749 } |
751 | 750 |
752 gfx::Rect BrowserView::GetBounds() const { | 751 gfx::Rect BrowserView::GetBounds() const { |
753 return frame_->GetWindow()->GetBounds(); | 752 return frame_->GetBounds(); |
754 } | 753 } |
755 | 754 |
756 bool BrowserView::IsMaximized() const { | 755 bool BrowserView::IsMaximized() const { |
757 return frame_->GetWindow()->IsMaximized(); | 756 return frame_->IsMaximized(); |
758 } | 757 } |
759 | 758 |
760 void BrowserView::SetFullscreen(bool fullscreen) { | 759 void BrowserView::SetFullscreen(bool fullscreen) { |
761 if (IsFullscreen() == fullscreen) | 760 if (IsFullscreen() == fullscreen) |
762 return; // Nothing to do. | 761 return; // Nothing to do. |
763 | 762 |
764 #if defined(OS_WIN) | 763 #if defined(OS_WIN) |
765 ProcessFullscreen(fullscreen); | 764 ProcessFullscreen(fullscreen); |
766 #else | 765 #else |
767 // On Linux changing fullscreen is async. Ask the window to change it's | 766 // On Linux changing fullscreen is async. Ask the window to change it's |
768 // fullscreen state, and when done invoke ProcessFullscreen. | 767 // fullscreen state, and when done invoke ProcessFullscreen. |
769 frame_->GetWindow()->SetFullscreen(fullscreen); | 768 frame_->SetFullscreen(fullscreen); |
770 #endif | 769 #endif |
771 } | 770 } |
772 | 771 |
773 bool BrowserView::IsFullscreen() const { | 772 bool BrowserView::IsFullscreen() const { |
774 return frame_->GetWindow()->IsFullscreen(); | 773 return frame_->IsFullscreen(); |
775 } | 774 } |
776 | 775 |
777 bool BrowserView::IsFullscreenBubbleVisible() const { | 776 bool BrowserView::IsFullscreenBubbleVisible() const { |
778 return fullscreen_bubble_.get() ? true : false; | 777 return fullscreen_bubble_.get() ? true : false; |
779 } | 778 } |
780 | 779 |
781 void BrowserView::FullScreenStateChanged() { | 780 void BrowserView::FullScreenStateChanged() { |
782 ProcessFullscreen(IsFullscreen()); | 781 ProcessFullscreen(IsFullscreen()); |
783 } | 782 } |
784 | 783 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 if (UseCompactNavigationBar()) { | 971 if (UseCompactNavigationBar()) { |
973 return false; | 972 return false; |
974 } else { | 973 } else { |
975 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || | 974 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || |
976 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); | 975 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); |
977 } | 976 } |
978 } | 977 } |
979 | 978 |
980 void BrowserView::DisableInactiveFrame() { | 979 void BrowserView::DisableInactiveFrame() { |
981 #if defined(OS_WIN) | 980 #if defined(OS_WIN) |
982 frame_->GetWindow()->DisableInactiveRendering(); | 981 frame_->DisableInactiveRendering(); |
983 #endif // No tricks are needed to get the right behavior on Linux. | 982 #endif // No tricks are needed to get the right behavior on Linux. |
984 } | 983 } |
985 | 984 |
986 void BrowserView::ConfirmSetDefaultSearchProvider( | 985 void BrowserView::ConfirmSetDefaultSearchProvider( |
987 TabContents* tab_contents, | 986 TabContents* tab_contents, |
988 TemplateURL* template_url, | 987 TemplateURL* template_url, |
989 TemplateURLModel* template_url_model) { | 988 TemplateURLModel* template_url_model) { |
990 #if defined(OS_WIN) | 989 #if defined(OS_WIN) |
991 DefaultSearchView::Show(tab_contents, template_url, template_url_model); | 990 DefaultSearchView::Show(tab_contents, template_url, template_url_model); |
992 #else | 991 #else |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 TabContentsWrapper* tab_contents) { | 1105 TabContentsWrapper* tab_contents) { |
1107 browser::ShowCreateWebAppShortcutsDialog(GetNativeHandle(), tab_contents); | 1106 browser::ShowCreateWebAppShortcutsDialog(GetNativeHandle(), tab_contents); |
1108 } | 1107 } |
1109 | 1108 |
1110 void BrowserView::ShowCreateChromeAppShortcutsDialog(Profile* profile, | 1109 void BrowserView::ShowCreateChromeAppShortcutsDialog(Profile* profile, |
1111 const Extension* app) { | 1110 const Extension* app) { |
1112 browser::ShowCreateChromeAppShortcutsDialog(GetNativeHandle(), profile, app); | 1111 browser::ShowCreateChromeAppShortcutsDialog(GetNativeHandle(), profile, app); |
1113 } | 1112 } |
1114 | 1113 |
1115 void BrowserView::UserChangedTheme() { | 1114 void BrowserView::UserChangedTheme() { |
1116 frame_->GetWindow()->FrameTypeChanged(); | 1115 frame_->FrameTypeChanged(); |
1117 } | 1116 } |
1118 | 1117 |
1119 int BrowserView::GetExtraRenderViewHeight() const { | 1118 int BrowserView::GetExtraRenderViewHeight() const { |
1120 // Currently this is only used on linux. | 1119 // Currently this is only used on linux. |
1121 return 0; | 1120 return 0; |
1122 } | 1121 } |
1123 | 1122 |
1124 void BrowserView::TabContentsFocused(TabContents* tab_contents) { | 1123 void BrowserView::TabContentsFocused(TabContents* tab_contents) { |
1125 contents_container_->TabContentsFocused(tab_contents); | 1124 contents_container_->TabContentsFocused(tab_contents); |
1126 } | 1125 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 // position of the resulting window. | 1590 // position of the resulting window. |
1592 if (IsToolbarVisible()) { | 1591 if (IsToolbarVisible()) { |
1593 // If we're showing the toolbar, we need to adjust |*bounds| to include | 1592 // If we're showing the toolbar, we need to adjust |*bounds| to include |
1594 // its desired height, since the toolbar is considered part of the | 1593 // its desired height, since the toolbar is considered part of the |
1595 // window's client area as far as GetWindowBoundsForClientBounds is | 1594 // window's client area as far as GetWindowBoundsForClientBounds is |
1596 // concerned... | 1595 // concerned... |
1597 bounds->set_height( | 1596 bounds->set_height( |
1598 bounds->height() + toolbar_->GetPreferredSize().height()); | 1597 bounds->height() + toolbar_->GetPreferredSize().height()); |
1599 } | 1598 } |
1600 | 1599 |
1601 gfx::Rect window_rect = frame_->GetWindow()->non_client_view()-> | 1600 gfx::Rect window_rect = frame_->non_client_view()-> |
1602 GetWindowBoundsForClientBounds(*bounds); | 1601 GetWindowBoundsForClientBounds(*bounds); |
1603 window_rect.set_origin(bounds->origin()); | 1602 window_rect.set_origin(bounds->origin()); |
1604 | 1603 |
1605 // When we are given x/y coordinates of 0 on a created popup window, | 1604 // When we are given x/y coordinates of 0 on a created popup window, |
1606 // assume none were given by the window.open() command. | 1605 // assume none were given by the window.open() command. |
1607 if (window_rect.x() == 0 && window_rect.y() == 0) { | 1606 if (window_rect.x() == 0 && window_rect.y() == 0) { |
1608 gfx::Size size = window_rect.size(); | 1607 gfx::Size size = window_rect.size(); |
1609 window_rect.set_origin(WindowSizer::GetDefaultPopupOrigin(size)); | 1608 window_rect.set_origin(WindowSizer::GetDefaultPopupOrigin(size)); |
1610 } | 1609 } |
1611 | 1610 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 | 1672 |
1674 // Give beforeunload handlers the chance to cancel the close before we hide | 1673 // Give beforeunload handlers the chance to cancel the close before we hide |
1675 // the window below. | 1674 // the window below. |
1676 if (!browser_->ShouldCloseWindow()) | 1675 if (!browser_->ShouldCloseWindow()) |
1677 return false; | 1676 return false; |
1678 | 1677 |
1679 if (!browser_->tabstrip_model()->empty()) { | 1678 if (!browser_->tabstrip_model()->empty()) { |
1680 // Tab strip isn't empty. Hide the frame (so it appears to have closed | 1679 // Tab strip isn't empty. Hide the frame (so it appears to have closed |
1681 // immediately) and close all the tabs, allowing the renderers to shut | 1680 // immediately) and close all the tabs, allowing the renderers to shut |
1682 // down. When the tab strip is empty we'll be called back again. | 1681 // down. When the tab strip is empty we'll be called back again. |
1683 frame_->GetWindow()->HideWindow(); | 1682 frame_->HideWindow(); |
1684 browser_->OnWindowClosing(); | 1683 browser_->OnWindowClosing(); |
1685 return false; | 1684 return false; |
1686 } | 1685 } |
1687 | 1686 |
1688 // Empty TabStripModel, it's now safe to allow the Window to be closed. | 1687 // Empty TabStripModel, it's now safe to allow the Window to be closed. |
1689 NotificationService::current()->Notify( | 1688 NotificationService::current()->Notify( |
1690 NotificationType::WINDOW_CLOSED, | 1689 NotificationType::WINDOW_CLOSED, |
1691 Source<gfx::NativeWindow>(frame_->GetWindow()->GetNativeWindow()), | 1690 Source<gfx::NativeWindow>(frame_->GetNativeWindow()), |
1692 NotificationService::NoDetails()); | 1691 NotificationService::NoDetails()); |
1693 return true; | 1692 return true; |
1694 } | 1693 } |
1695 | 1694 |
1696 int BrowserView::NonClientHitTest(const gfx::Point& point) { | 1695 int BrowserView::NonClientHitTest(const gfx::Point& point) { |
1697 #if defined(OS_WIN) | 1696 #if defined(OS_WIN) |
1698 // The following code is not in the LayoutManager because it's | 1697 // The following code is not in the LayoutManager because it's |
1699 // independent of layout and also depends on the ResizeCorner which | 1698 // independent of layout and also depends on the ResizeCorner which |
1700 // is private. | 1699 // is private. |
1701 if (!frame_->GetWindow()->IsMaximized() && | 1700 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) { |
1702 !frame_->GetWindow()->IsFullscreen()) { | |
1703 CRect client_rect; | 1701 CRect client_rect; |
1704 ::GetClientRect(frame_->GetWindow()->GetNativeWindow(), &client_rect); | 1702 ::GetClientRect(frame_->GetNativeWindow(), &client_rect); |
1705 gfx::Size resize_corner_size = ResizeCorner::GetSize(); | 1703 gfx::Size resize_corner_size = ResizeCorner::GetSize(); |
1706 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), | 1704 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), |
1707 client_rect.bottom - resize_corner_size.height(), | 1705 client_rect.bottom - resize_corner_size.height(), |
1708 resize_corner_size.width(), resize_corner_size.height()); | 1706 resize_corner_size.width(), resize_corner_size.height()); |
1709 bool rtl_dir = base::i18n::IsRTL(); | 1707 bool rtl_dir = base::i18n::IsRTL(); |
1710 if (rtl_dir) | 1708 if (rtl_dir) |
1711 resize_corner_rect.set_x(0); | 1709 resize_corner_rect.set_x(0); |
1712 if (resize_corner_rect.Contains(point)) { | 1710 if (resize_corner_rect.Contains(point)) { |
1713 if (rtl_dir) | 1711 if (rtl_dir) |
1714 return HTBOTTOMLEFT; | 1712 return HTBOTTOMLEFT; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 Layout(); | 1794 Layout(); |
1797 } | 1795 } |
1798 | 1796 |
1799 void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { | 1797 void BrowserView::GetAccessibleState(ui::AccessibleViewState* state) { |
1800 state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 1798 state->name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
1801 state->role = ui::AccessibilityTypes::ROLE_CLIENT; | 1799 state->role = ui::AccessibilityTypes::ROLE_CLIENT; |
1802 } | 1800 } |
1803 | 1801 |
1804 SkColor BrowserView::GetInfoBarSeparatorColor() const { | 1802 SkColor BrowserView::GetInfoBarSeparatorColor() const { |
1805 // NOTE: Keep this in sync with ToolbarView::OnPaint()! | 1803 // NOTE: Keep this in sync with ToolbarView::OnPaint()! |
1806 return (IsTabStripVisible() || | 1804 return (IsTabStripVisible() || !frame_->non_client_view()->UseNativeFrame()) ? |
1807 !frame_->GetWindow()->non_client_view()->UseNativeFrame()) ? | |
1808 ResourceBundle::toolbar_separator_color : SK_ColorBLACK; | 1805 ResourceBundle::toolbar_separator_color : SK_ColorBLACK; |
1809 } | 1806 } |
1810 | 1807 |
1811 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { | 1808 void BrowserView::InfoBarContainerStateChanged(bool is_animating) { |
1812 ToolbarSizeChanged(is_animating); | 1809 ToolbarSizeChanged(is_animating); |
1813 } | 1810 } |
1814 | 1811 |
1815 bool BrowserView::DrawInfoBarArrows(int* x) const { | 1812 bool BrowserView::DrawInfoBarArrows(int* x) const { |
1816 if (x) { | 1813 if (x) { |
1817 const LocationIconView* location_icon_view = | 1814 const LocationIconView* location_icon_view = |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 | 1924 |
1928 // Create a custom JumpList and add it to an observer of TabRestoreService | 1925 // Create a custom JumpList and add it to an observer of TabRestoreService |
1929 // so we can update the custom JumpList when a tab is added or removed. | 1926 // so we can update the custom JumpList when a tab is added or removed. |
1930 if (JumpList::Enabled()) { | 1927 if (JumpList::Enabled()) { |
1931 jumplist_.reset(new JumpList); | 1928 jumplist_.reset(new JumpList); |
1932 jumplist_->AddObserver(browser_->profile()); | 1929 jumplist_->AddObserver(browser_->profile()); |
1933 } | 1930 } |
1934 | 1931 |
1935 if (AeroPeekManager::Enabled()) { | 1932 if (AeroPeekManager::Enabled()) { |
1936 aeropeek_manager_.reset(new AeroPeekManager( | 1933 aeropeek_manager_.reset(new AeroPeekManager( |
1937 frame_->GetWindow()->GetNativeWindow())); | 1934 frame_->GetNativeWindow())); |
1938 browser_->tabstrip_model()->AddObserver(aeropeek_manager_.get()); | 1935 browser_->tabstrip_model()->AddObserver(aeropeek_manager_.get()); |
1939 } | 1936 } |
1940 #endif | 1937 #endif |
1941 // Only create our compact navigation classes if the switch is enabled. Note | 1938 // Only create our compact navigation classes if the switch is enabled. Note |
1942 // that we directly check the switch and not the pref as the switch may be on | 1939 // that we directly check the switch and not the pref as the switch may be on |
1943 // and the pref could be off (currently not selected in the context menu). | 1940 // and the pref could be off (currently not selected in the context menu). |
1944 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1941 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1945 switches::kEnableCompactNavigation)) { | 1942 switches::kEnableCompactNavigation)) { |
1946 compact_location_bar_view_host_.reset(new CompactLocationBarViewHost(this)); | 1943 compact_location_bar_view_host_.reset(new CompactLocationBarViewHost(this)); |
1947 compact_navigation_bar_ = new CompactNavigationBar(this); | 1944 compact_navigation_bar_ = new CompactNavigationBar(this); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 void BrowserView::InitSystemMenu() { | 1992 void BrowserView::InitSystemMenu() { |
1996 system_menu_contents_.reset(new views::SystemMenuModel(this)); | 1993 system_menu_contents_.reset(new views::SystemMenuModel(this)); |
1997 // We add the menu items in reverse order so that insertion_index never needs | 1994 // We add the menu items in reverse order so that insertion_index never needs |
1998 // to change. | 1995 // to change. |
1999 if (IsBrowserTypeNormal()) | 1996 if (IsBrowserTypeNormal()) |
2000 BuildSystemMenuForBrowserWindow(); | 1997 BuildSystemMenuForBrowserWindow(); |
2001 else | 1998 else |
2002 BuildSystemMenuForAppOrPopupWindow(); | 1999 BuildSystemMenuForAppOrPopupWindow(); |
2003 system_menu_.reset( | 2000 system_menu_.reset( |
2004 new views::NativeMenuWin(system_menu_contents_.get(), | 2001 new views::NativeMenuWin(system_menu_contents_.get(), |
2005 frame_->GetWindow()->GetNativeWindow())); | 2002 frame_->GetNativeWindow())); |
2006 system_menu_->Rebuild(); | 2003 system_menu_->Rebuild(); |
2007 } | 2004 } |
2008 #endif | 2005 #endif |
2009 | 2006 |
2010 BrowserViewLayout* BrowserView::GetBrowserViewLayout() const { | 2007 BrowserViewLayout* BrowserView::GetBrowserViewLayout() const { |
2011 return static_cast<BrowserViewLayout*>(GetLayoutManager()); | 2008 return static_cast<BrowserViewLayout*>(GetLayoutManager()); |
2012 } | 2009 } |
2013 | 2010 |
2014 void BrowserView::LayoutStatusBubble() { | 2011 void BrowserView::LayoutStatusBubble() { |
2015 // In restored mode, the client area has a client edge between it and the | 2012 // In restored mode, the client area has a client edge between it and the |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 // If we don't hide the edit and force it to not show until we come out of | 2244 // If we don't hide the edit and force it to not show until we come out of |
2248 // fullscreen, then if the user was on the New Tab Page, the edit contents | 2245 // fullscreen, then if the user was on the New Tab Page, the edit contents |
2249 // will appear atop the web contents once we go into fullscreen mode. This | 2246 // will appear atop the web contents once we go into fullscreen mode. This |
2250 // has something to do with how we move the main window while it's hidden; | 2247 // has something to do with how we move the main window while it's hidden; |
2251 // if we don't hide the main window below, we don't get this problem. | 2248 // if we don't hide the main window below, we don't get this problem. |
2252 omnibox_view->set_force_hidden(true); | 2249 omnibox_view->set_force_hidden(true); |
2253 ShowWindow(omnibox_view->m_hWnd, SW_HIDE); | 2250 ShowWindow(omnibox_view->m_hWnd, SW_HIDE); |
2254 #endif | 2251 #endif |
2255 } | 2252 } |
2256 #if defined(OS_WIN) | 2253 #if defined(OS_WIN) |
2257 static_cast<views::WindowWin*>( | 2254 static_cast<views::WindowWin*>(frame_->native_window())->PushForceHidden(); |
2258 frame_->GetWindow()->native_window())->PushForceHidden(); | |
2259 #endif | 2255 #endif |
2260 | 2256 |
2261 // Notify bookmark bar, so it can set itself to the appropriate drawing state. | 2257 // Notify bookmark bar, so it can set itself to the appropriate drawing state. |
2262 if (bookmark_bar_view_.get()) | 2258 if (bookmark_bar_view_.get()) |
2263 bookmark_bar_view_->OnFullscreenToggled(fullscreen); | 2259 bookmark_bar_view_->OnFullscreenToggled(fullscreen); |
2264 | 2260 |
2265 // Toggle fullscreen mode. | 2261 // Toggle fullscreen mode. |
2266 #if defined(OS_WIN) | 2262 #if defined(OS_WIN) |
2267 frame_->GetWindow()->SetFullscreen(fullscreen); | 2263 frame_->SetFullscreen(fullscreen); |
2268 #endif // No need to invoke SetFullscreen for linux as this code is executed | 2264 #endif // No need to invoke SetFullscreen for linux as this code is executed |
2269 // once we're already fullscreen on linux. | 2265 // once we're already fullscreen on linux. |
2270 | 2266 |
2271 #if defined(TOOLKIT_USES_GTK) | 2267 #if defined(TOOLKIT_USES_GTK) |
2272 // Updating of commands for fullscreen mode is called from SetFullScreen on | 2268 // Updating of commands for fullscreen mode is called from SetFullScreen on |
2273 // Wndows (see just above), but for ChromeOS, this method (ProcessFullScreen) | 2269 // Wndows (see just above), but for ChromeOS, this method (ProcessFullScreen) |
2274 // is called after full screen has happened successfully (via GTK's | 2270 // is called after full screen has happened successfully (via GTK's |
2275 // window-state-change event), so we have to update commands here. | 2271 // window-state-change event), so we have to update commands here. |
2276 browser_->UpdateCommandsForFullscreenMode(fullscreen); | 2272 browser_->UpdateCommandsForFullscreenMode(fullscreen); |
2277 #endif | 2273 #endif |
(...skipping 11 matching lines...) Expand all Loading... |
2289 omnibox_view->set_force_hidden(false); | 2285 omnibox_view->set_force_hidden(false); |
2290 ShowWindow(omnibox_view->m_hWnd, SW_SHOW); | 2286 ShowWindow(omnibox_view->m_hWnd, SW_SHOW); |
2291 #endif | 2287 #endif |
2292 } | 2288 } |
2293 | 2289 |
2294 // Undo our anti-jankiness hacks and force the window to relayout now that | 2290 // Undo our anti-jankiness hacks and force the window to relayout now that |
2295 // it's in its final position. | 2291 // it's in its final position. |
2296 ignore_layout_ = false; | 2292 ignore_layout_ = false; |
2297 Layout(); | 2293 Layout(); |
2298 #if defined(OS_WIN) | 2294 #if defined(OS_WIN) |
2299 static_cast<views::WindowWin*>( | 2295 static_cast<views::WindowWin*>(frame_->native_window())->PopForceHidden(); |
2300 frame_->GetWindow()->native_window())->PopForceHidden(); | |
2301 #endif | 2296 #endif |
2302 } | 2297 } |
2303 | 2298 |
2304 | 2299 |
2305 void BrowserView::LoadAccelerators() { | 2300 void BrowserView::LoadAccelerators() { |
2306 #if defined(OS_WIN) | 2301 #if defined(OS_WIN) |
2307 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME); | 2302 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME); |
2308 DCHECK(accelerator_table); | 2303 DCHECK(accelerator_table); |
2309 | 2304 |
2310 // We have to copy the table to access its contents. | 2305 // We have to copy the table to access its contents. |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 toolbar_->Init(browser_->profile()); | 2568 toolbar_->Init(browser_->profile()); |
2574 } | 2569 } |
2575 } | 2570 } |
2576 | 2571 |
2577 #if !defined(OS_CHROMEOS) | 2572 #if !defined(OS_CHROMEOS) |
2578 // static | 2573 // static |
2579 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2574 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2580 // Create the view and the frame. The frame will attach itself via the view | 2575 // Create the view and the frame. The frame will attach itself via the view |
2581 // so we don't need to do anything with the pointer. | 2576 // so we don't need to do anything with the pointer. |
2582 BrowserView* view = new BrowserView(browser); | 2577 BrowserView* view = new BrowserView(browser); |
2583 BrowserFrame::Create(view, browser->profile()); | 2578 (new BrowserFrame(view))->InitBrowserFrame(); |
2584 | |
2585 view->GetWindow()->non_client_view()->SetAccessibleName( | 2579 view->GetWindow()->non_client_view()->SetAccessibleName( |
2586 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2580 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
2587 | |
2588 return view; | 2581 return view; |
2589 } | 2582 } |
2590 #endif | 2583 #endif |
2591 | 2584 |
2592 // static | 2585 // static |
2593 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2586 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
2594 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2587 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
2595 } | 2588 } |
OLD | NEW |