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

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

Issue 9630002: Ash: Remove compact window mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OpaqueBrowserFrameView, MultipleWindowIndicatorButton Created 8 years, 9 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/ui/views/frame/compact_browser_frame_view.h"
6
7 #include "chrome/browser/themes/theme_service_factory.h"
8 #include "chrome/browser/themes/theme_service.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "grit/generated_resources.h"
11 #include "grit/theme_resources.h"
12 #include "grit/theme_resources_standard.h"
13 #include "ui/base/hit_test.h"
14 #include "ui/base/theme_provider.h"
15
16 namespace {
17 // Width of area to the left of first tab for which mouse events should be
18 // forwarded to the first tab.
19 const int kLeftPad = 15;
20 // Additional pixels of pad above the tabs.
21 const int kTopPad = 4;
22 // To align theme bitmaps correctly we return this offset.
23 const int kThemeOffset = -5;
24 }
25
26 // CompactBrowserFrameView adds a few pixels of pad to the top of the
27 // tabstrip and clicks left of first tab should be forwarded to the first tab.
28 // To enable this we have to grab mouse events in that area and forward them on
29 // to the NonClientView. We do this by overriding HitTest(), NonClientHitTest()
30 // and GetEventHandlerForPoint().
31 CompactBrowserFrameView::CompactBrowserFrameView(
32 BrowserFrame* frame, BrowserView* browser_view)
33 : OpaqueBrowserFrameView(frame, browser_view) {
34 }
35
36 CompactBrowserFrameView::~CompactBrowserFrameView() {
37 }
38
39 int CompactBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
40 if (point.x() < kLeftPad || point.y() < kTopPad)
41 return HTNOWHERE;
42 return OpaqueBrowserFrameView::NonClientHitTest(point);
43 }
44
45 bool CompactBrowserFrameView::HitTest(const gfx::Point& l) const {
46 if (l.x() < kLeftPad || l.y() < kTopPad)
47 return true;
48 return OpaqueBrowserFrameView::HitTest(l);
49 }
50
51 views::View* CompactBrowserFrameView::GetEventHandlerForPoint(
52 const gfx::Point& point) {
53 if (point.x() < kLeftPad || point.y() < kTopPad) {
54 gfx::Point nc_point(std::max(kLeftPad, point.x()),
55 std::max(kTopPad, point.y()));
56 views::NonClientView* nc_view = frame()->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 int CompactBrowserFrameView::GetHorizontalTabStripVerticalOffset(
64 bool restored) const {
65 return NonClientTopBorderHeight(restored) + kTopPad;
66 }
67
68 void CompactBrowserFrameView::ModifyMaximizedFramePainting(
69 int* top_offset,
70 SkBitmap** theme_frame,
71 SkBitmap** left_corner,
72 SkBitmap** right_corner) {
73 *top_offset = kThemeOffset;
74 ui::ThemeProvider* tp = GetThemeProvider();
75 if (!ThemeServiceFactory::GetForProfile(
76 browser_view()->browser()->profile())->UsingDefaultTheme())
77 return;
78 if (browser_view()->IsOffTheRecord()) {
79 #if defined(USE_AURA)
80 *theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_COMPACT);
81 #endif
82 *left_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_LEFT);
83 *right_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_RIGHT);
84 } else {
85 #if defined(USE_AURA)
86 *theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_COMPACT);
87 #endif
88 *left_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_LEFT);
89 *right_corner = tp->GetBitmapNamed(IDR_THEME_FRAME_RIGHT);
90 }
91 }
92
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/compact_browser_frame_view.h ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698