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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 18859004: views impl: hide top infobar arrow when omnibox popup shows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: correct previous comment Created 7 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 forwards ? 1086 forwards ?
1087 views::FocusManager::kForward : views::FocusManager::kBackward, 1087 views::FocusManager::kForward : views::FocusManager::kBackward,
1088 views::FocusManager::kWrap); 1088 views::FocusManager::kWrap);
1089 } 1089 }
1090 1090
1091 void BrowserView::DestroyBrowser() { 1091 void BrowserView::DestroyBrowser() {
1092 // After this returns other parts of Chrome are going to be shutdown. Close 1092 // After this returns other parts of Chrome are going to be shutdown. Close
1093 // the window now so that we are deleted immediately and aren't left holding 1093 // the window now so that we are deleted immediately and aren't left holding
1094 // references to deleted objects. 1094 // references to deleted objects.
1095 GetWidget()->RemoveObserver(this); 1095 GetWidget()->RemoveObserver(this);
1096 GetLocationBar()->GetLocationEntry()->model()->popup_model()->RemoveObserver(
1097 this);
1096 frame_->CloseNow(); 1098 frame_->CloseNow();
1097 } 1099 }
1098 1100
1099 bool BrowserView::IsBookmarkBarVisible() const { 1101 bool BrowserView::IsBookmarkBarVisible() const {
1100 if (!browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR)) 1102 if (!browser_->SupportsWindowFeature(Browser::FEATURE_BOOKMARKBAR))
1101 return false; 1103 return false;
1102 if (!bookmark_bar_view_.get()) 1104 if (!bookmark_bar_view_.get())
1103 return false; 1105 return false;
1104 if (bookmark_bar_view_->GetPreferredSize().height() == 0) 1106 if (bookmark_bar_view_->GetPreferredSize().height() == 0)
1105 return false; 1107 return false;
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 DCHECK(iter != accelerator_table_.end()); 1911 DCHECK(iter != accelerator_table_.end());
1910 int command_id = iter->second; 1912 int command_id = iter->second;
1911 1913
1912 chrome::BrowserCommandController* controller = browser_->command_controller(); 1914 chrome::BrowserCommandController* controller = browser_->command_controller();
1913 if (!controller->block_command_execution()) 1915 if (!controller->block_command_execution())
1914 UpdateAcceleratorMetrics(accelerator, command_id); 1916 UpdateAcceleratorMetrics(accelerator, command_id);
1915 return chrome::ExecuteCommand(browser_.get(), command_id); 1917 return chrome::ExecuteCommand(browser_.get(), command_id);
1916 } 1918 }
1917 1919
1918 /////////////////////////////////////////////////////////////////////////////// 1920 ///////////////////////////////////////////////////////////////////////////////
1921 // BrowserView, OmniboxPopupModelObserver overrides:
1922 void BrowserView::OnOmniboxPopupShownOrHidden() {
1923 infobar_container_->SetMaxTopArrowHeight(GetMaxTopInfoBarArrowHeight());
1924 }
1925
1926 ///////////////////////////////////////////////////////////////////////////////
1919 // BrowserView, ImmersiveModeController::Delegate overrides: 1927 // BrowserView, ImmersiveModeController::Delegate overrides:
1920 1928
1921 BookmarkBarView* BrowserView::GetBookmarkBar() { 1929 BookmarkBarView* BrowserView::GetBookmarkBar() {
1922 return bookmark_bar_view_.get(); 1930 return bookmark_bar_view_.get();
1923 } 1931 }
1924 1932
1925 FullscreenController* BrowserView::GetFullscreenController() { 1933 FullscreenController* BrowserView::GetFullscreenController() {
1926 // Cannot be injected into ImmersiveModeController because it is constructed 1934 // Cannot be injected into ImmersiveModeController because it is constructed
1927 // after BrowserView. 1935 // after BrowserView.
1928 return browser()->fullscreen_controller(); 1936 return browser()->fullscreen_controller();
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 SetLayoutManager(browser_view_layout); 2092 SetLayoutManager(browser_view_layout);
2085 2093
2086 #if defined(OS_WIN) && !defined(USE_AURA) 2094 #if defined(OS_WIN) && !defined(USE_AURA)
2087 // Create a custom JumpList and add it to an observer of TabRestoreService 2095 // Create a custom JumpList and add it to an observer of TabRestoreService
2088 // so we can update the custom JumpList when a tab is added or removed. 2096 // so we can update the custom JumpList when a tab is added or removed.
2089 if (JumpList::Enabled()) { 2097 if (JumpList::Enabled()) {
2090 load_complete_listener_.reset(new LoadCompleteListener(this)); 2098 load_complete_listener_.reset(new LoadCompleteListener(this));
2091 } 2099 }
2092 #endif 2100 #endif
2093 2101
2102 GetLocationBar()->GetLocationEntry()->model()->popup_model()->AddObserver(
2103 this);
2104
2094 // We're now initialized and ready to process Layout requests. 2105 // We're now initialized and ready to process Layout requests.
2095 ignore_layout_ = false; 2106 ignore_layout_ = false;
2096 } 2107 }
2097 2108
2098 void BrowserView::LoadingAnimationCallback() { 2109 void BrowserView::LoadingAnimationCallback() {
2099 base::TimeTicks now = base::TimeTicks::Now(); 2110 base::TimeTicks now = base::TimeTicks::Now();
2100 if (!last_animation_time_.is_null()) { 2111 if (!last_animation_time_.is_null()) {
2101 UMA_HISTOGRAM_TIMES( 2112 UMA_HISTOGRAM_TIMES(
2102 "Tabs.LoadingAnimationTime", 2113 "Tabs.LoadingAnimationTime",
2103 now - last_animation_time_); 2114 now - last_animation_time_);
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 overlay->SetBoundsRect(contents_web_view_->bounds()); 2763 overlay->SetBoundsRect(contents_web_view_->bounds());
2753 contents_container_->AddChildView(overlay); 2764 contents_container_->AddChildView(overlay);
2754 contents_container_->SetActive(overlay); 2765 contents_container_->SetActive(overlay);
2755 2766
2756 // Overlay is gone, force re-layout of |BrowserView| and infobars. 2767 // Overlay is gone, force re-layout of |BrowserView| and infobars.
2757 OnOverlayStateChanged(true); 2768 OnOverlayStateChanged(true);
2758 } 2769 }
2759 2770
2760 int BrowserView::GetMaxTopInfoBarArrowHeight() { 2771 int BrowserView::GetMaxTopInfoBarArrowHeight() {
2761 int top_arrow_height = 0; 2772 int top_arrow_height = 0;
2762 // Only show the arrows when not in fullscreen and when there's no overlay. 2773 // Only show the arrows when not in fullscreen and when there's no overlay
2763 if (!IsFullscreen() && !overlay_container_->visible()) { 2774 // and no omnibox popup.
2775 if (!IsFullscreen() && !overlay_container_->visible() &&
2776 !GetLocationBar()->GetLocationEntry()->model()->popup_model()->IsOpen()) {
2764 const LocationIconView* location_icon_view = 2777 const LocationIconView* location_icon_view =
2765 toolbar_->location_bar()->location_icon_view(); 2778 toolbar_->location_bar()->location_icon_view();
2766 // The +1 in the next line creates a 1-px gap between icon and arrow tip. 2779 // The +1 in the next line creates a 1-px gap between icon and arrow tip.
2767 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - 2780 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() -
2768 LocationBarView::kIconInternalPadding + 1); 2781 LocationBarView::kIconInternalPadding + 1);
2769 ConvertPointToTarget(location_icon_view, this, &icon_bottom); 2782 ConvertPointToTarget(location_icon_view, this, &icon_bottom);
2770 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); 2783 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL));
2771 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2784 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2772 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2785 top_arrow_height = infobar_top.y() - icon_bottom.y();
2773 } 2786 }
2774 return top_arrow_height; 2787 return top_arrow_height;
2775 } 2788 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698