Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/frame/browser_frame_view_chromeos.h" | |
| 6 | |
| 7 #include "chrome/browser/ui/views/frame/browser_view.h" | |
| 8 #include "grit/generated_resources.h" | |
| 9 #include "grit/theme_resources.h" | |
| 10 #include "grit/theme_resources_standard.h" | |
| 11 #include "views/window/hit_test.h" | |
| 12 #include "views/window/window.h" | |
| 13 #include "ui/base/theme_provider.h" | |
| 14 | |
| 15 namespace { | |
| 16 // Additional pixels of pad above the tabs. | |
| 17 const int kTopPad = 4; | |
| 18 // To align theme bitmaps correctly we return this offset. | |
| 19 const int kThemeOffset = -5; | |
| 20 } | |
| 21 | |
| 22 namespace chromeos { | |
| 23 | |
| 24 // BrowserFrameViewChromeos adds some a few pixels of pad to the top of the | |
|
sky
2011/05/02 14:26:27
remove some
| |
| 25 // tabstrip. To enable this we have to grab mouse events in that area and | |
| 26 // forward them on to the NonClientView. We do this by overriding HitTest(), | |
| 27 // NonClientHitTest() and GetEventHandlerForPoint(). | |
| 28 BrowserFrameViewChromeos::BrowserFrameViewChromeos( | |
| 29 BrowserFrame* frame, BrowserView* browser_view) | |
| 30 : OpaqueBrowserFrameView(frame, browser_view) { | |
| 31 } | |
| 32 | |
| 33 BrowserFrameViewChromeos::~BrowserFrameViewChromeos() { | |
| 34 } | |
| 35 | |
| 36 int BrowserFrameViewChromeos::GetHorizontalTabStripVerticalOffset( | |
|
sky
2011/05/02 14:26:27
order doesn't match header.
| |
| 37 bool restored) const { | |
| 38 return NonClientTopBorderHeight(restored, true) + kTopPad; | |
| 39 } | |
| 40 | |
| 41 int BrowserFrameViewChromeos::NonClientHitTest(const gfx::Point& point) { | |
| 42 if (point.y() < kTopPad) | |
| 43 return HTNOWHERE; | |
| 44 return OpaqueBrowserFrameView::NonClientHitTest(point); | |
| 45 } | |
| 46 | |
| 47 bool BrowserFrameViewChromeos::HitTest(const gfx::Point& l) const { | |
| 48 if (l.y() < kTopPad) | |
| 49 return true; | |
| 50 return OpaqueBrowserFrameView::HitTest(l); | |
| 51 } | |
| 52 | |
| 53 views::View* BrowserFrameViewChromeos::GetEventHandlerForPoint(const gfx::Point& point) { | |
|
sky
2011/05/02 14:26:27
> 80
| |
| 54 if (point.y() < kTopPad) { | |
| 55 gfx::Point nc_point(point.x(), kTopPad); | |
| 56 views::NonClientView* nc_view = frame()->GetWindow()->non_client_view(); | |
| 57 View::ConvertPointToView(this, nc_view, &nc_point); | |
| 58 return nc_view->GetEventHandlerForPoint(nc_point); | |
| 59 } | |
| 60 return OpaqueBrowserFrameView::GetEventHandlerForPoint(point); | |
| 61 } | |
| 62 | |
| 63 void BrowserFrameViewChromeos::ModifyMaximizedFramePainting( | |
| 64 int* top_offset, SkBitmap** left_corner, SkBitmap** right_corner) { | |
| 65 *top_offset = kThemeOffset; | |
| 66 ui::ThemeProvider* tp = GetThemeProvider(); | |
| 67 if (tp->HasCustomImage(IDR_THEME_FRAME)) | |
| 68 return; | |
| 69 if (browser_view()->IsOffTheRecord()) { | |
| 70 *left_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_LEFT); | |
| 71 *right_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_RIGHT); | |
| 72 } else { | |
| 73 *left_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_LEFT); | |
| 74 *right_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_RIGHT); | |
| 75 } | |
| 76 } | |
| 77 | |
| 78 } // namespace chromeos | |
| OLD | NEW |