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

Unified Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 6913026: Compact Navigation prototype (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index ae417260eac941ef06f9970832a00a6ac94fe352..ffb89bdbffd556090b3f2a8c355081cf40aa8bf7 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -90,6 +90,19 @@ const int kTabStripIndent = 1;
// Inset from the top of the toolbar/tabstrip to the shadow. Used only for
// vertical tabs.
const int kVerticalTabBorderInset = 3;
+
+// Converts |bounds| from |src|'s coordinate system to |dst|, and checks if
+// |pt| is contained within.
+bool ConvertedContainsCheck(gfx::Rect bounds, const views::View* src,
+ const views::View* dst, const gfx::Point& pt) {
+ DCHECK(src);
+ DCHECK(dst);
+ gfx::Point origin(bounds.origin());
+ views::View::ConvertPointToView(src, dst, &origin);
+ bounds.set_origin(origin);
+ return bounds.Contains(pt);
+}
+
}
///////////////////////////////////////////////////////////////////////////////
@@ -392,7 +405,8 @@ void OpaqueBrowserFrameView::OnPaint(gfx::Canvas* canvas) {
else
PaintRestoredFrameBorder(canvas);
PaintTitleBar(canvas);
- if (browser_view_->IsToolbarVisible())
+ if (browser_view_->IsToolbarVisible() ||
+ browser_view_->UseCompactNavigationBar())
PaintToolbarBackground(canvas);
if (browser_view_->ShouldShowOffTheRecordAvatar())
PaintOTRAvatar(canvas);
@@ -425,6 +439,22 @@ bool OpaqueBrowserFrameView::HitTest(const gfx::Point& l) const {
return false;
}
+ // Claim it only if we're also not in the compact navigation buttons.
+ if (browser_view_->UseCompactNavigationBar()) {
sky 2011/05/03 18:38:32 Did you need to do anything in glass_browser_frame
SteveT 2011/05/06 18:48:43 No - it turns out GlassBrowserFrameView's HitTest
+ if (ConvertedContainsCheck(browser_view_->GetCompactNavigationBarBounds(),
+ frame_->GetWindow()->client_view(),
+ static_cast<const View*>(this),
+ l)) {
+ return false;
+ }
+ if (ConvertedContainsCheck(browser_view_->GetCompactOptionsBarBounds(),
+ frame_->GetWindow()->client_view(),
+ static_cast<const View*>(this),
+ l)) {
+ return false;
+ }
+ }
+
// We convert from our parent's coordinates since we assume we fill its bounds
// completely. We need to do this since we're not a parent of the tabstrip,
// meaning ConvertPointToView would otherwise return something bogus.
@@ -898,9 +928,10 @@ void OpaqueBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) {
gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height());
SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR);
- if (browser_view_->IsToolbarVisible()) {
+ if (browser_view_->IsToolbarVisible() ||
+ browser_view_->UseCompactNavigationBar()) {
// The client edge images always start below the toolbar corner images. The
- // client edge filled rects start there or at the bottom of the tooolbar,
+ // client edge filled rects start there or at the bottom of the toolbar,
// whichever is shorter.
gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds());
image_top += toolbar_bounds.y() +

Powered by Google App Engine
This is Rietveld 408576698