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

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h

Issue 9580001: Aura: Update window frames, allow resize from outside window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix caption for maximized windows, new resize cursor tweak 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
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 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_AURA_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_AURA_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_AURA_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_AURA_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ash/wm/window_frame.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
12 #include "ui/views/controls/button/button.h" 11 #include "chrome/browser/ui/views/tab_icon_view.h"
13 #include "ui/views/widget/widget.h" 12 #include "ui/views/controls/button/button.h" // ButtonListener
14 13
15 class BrowserFrame; 14 namespace views {
16 class BrowserView; 15 class FrameBackground;
17 class FrameBackgroundView; 16 class ImageButton;
18 class WindowControlButton; 17 }
19 18
20 class BrowserNonClientFrameViewAura : public BrowserNonClientFrameView, 19 class BrowserNonClientFrameViewAura : public BrowserNonClientFrameView,
21 public views::ButtonListener, 20 public views::ButtonListener,
22 public views::Widget::Observer, 21 public TabIconView::TabIconViewModel {
23 public ash::WindowFrame {
24 public: 22 public:
25 BrowserNonClientFrameViewAura(BrowserFrame* frame, BrowserView* browser_view); 23 BrowserNonClientFrameViewAura(BrowserFrame* frame, BrowserView* browser_view);
26 virtual ~BrowserNonClientFrameViewAura(); 24 virtual ~BrowserNonClientFrameViewAura();
27 25
28 // Control the slide-in animation of the frame background. 26 void Init();
29 void ShowFrameBackground();
30 void HideFrameBackground();
31
32 private:
33 // Returns a HitTest code.
34 int NonClientHitTestImpl(const gfx::Point& point);
35
36 // Returns the target rectangle for the frame background, based on a mouse
37 // position from |hittest_code| and the window's active/inactive state.
38 // Pass HTNOWHERE to get default bounds.
39 gfx::Rect GetFrameBackgroundBounds(int hittest_code, bool active_window);
40
41 // Recomputes the bounds of the semi-transparent frame background.
42 void UpdateFrameBackground(bool active_window);
43
44 // Invoked when the active state changes.
45 void ActiveStateChanged();
46 27
47 // BrowserNonClientFrameView overrides: 28 // BrowserNonClientFrameView overrides:
48 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; 29 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE;
49 virtual int GetHorizontalTabStripVerticalOffset(bool restored) const OVERRIDE; 30 virtual int GetHorizontalTabStripVerticalOffset(bool restored) const OVERRIDE;
50 virtual void UpdateThrobber(bool running) OVERRIDE; 31 virtual void UpdateThrobber(bool running) OVERRIDE;
51 32
52 // views::NonClientFrameView overrides: 33 // views::NonClientFrameView overrides:
53 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; 34 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
54 virtual gfx::Rect GetWindowBoundsForClientBounds( 35 virtual gfx::Rect GetWindowBoundsForClientBounds(
55 const gfx::Rect& client_bounds) const OVERRIDE; 36 const gfx::Rect& client_bounds) const OVERRIDE;
56 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 37 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
57 virtual void GetWindowMask(const gfx::Size& size, 38 virtual void GetWindowMask(const gfx::Size& size,
58 gfx::Path* window_mask) OVERRIDE; 39 gfx::Path* window_mask) OVERRIDE;
59 virtual void ResetWindowControls() OVERRIDE; 40 virtual void ResetWindowControls() OVERRIDE;
60 virtual void UpdateWindowIcon() OVERRIDE; 41 virtual void UpdateWindowIcon() OVERRIDE;
61 virtual void ShouldPaintAsActiveChanged() OVERRIDE;
62 42
63 // views::View overrides: 43 // views::View overrides:
44 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
64 virtual void Layout() OVERRIDE; 45 virtual void Layout() OVERRIDE;
65 virtual views::View* GetEventHandlerForPoint( 46 virtual bool HitTest(const gfx::Point& l) const OVERRIDE;
66 const gfx::Point& point) OVERRIDE; 47 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
67 virtual bool HitTest(const gfx::Point& p) const OVERRIDE;
68 virtual void OnMouseMoved(const views::MouseEvent& event) OVERRIDE;
69 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
70 virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE;
71 48
72 // views::ButtonListener overrides: 49 // views::ButtonListener overrides:
73 virtual void ButtonPressed(views::Button* sender, 50 virtual void ButtonPressed(views::Button* sender,
74 const views::Event& event) OVERRIDE; 51 const views::Event& event) OVERRIDE;
75 52
76 // views::Widget::Observer overrides: 53 // Overridden from TabIconView::TabIconViewModel:
77 virtual void OnWidgetActivationChanged(views::Widget* widget, 54 virtual bool ShouldTabIconViewAnimate() const OVERRIDE;
78 bool active) OVERRIDE; 55 virtual SkBitmap GetFaviconForTabIconView() OVERRIDE;
79 56
80 // ash::WindowFrame overrides: 57 private:
81 virtual void OnWindowHoverChanged(bool hovered) OVERRIDE; 58 // Sets the images for a button base on IDs from the frame's theme provider.
59 void SetButtonImages(views::ImageButton* button,
60 int normal_bitmap_id,
61 int hot_bitmap_id,
62 int pushed_bitmap_id);
82 63
83 int last_hittest_code_; 64 // Distance between top of window and client area.
84 WindowControlButton* maximize_button_; 65 int NonClientTopBorderHeight(bool restored) const;
85 WindowControlButton* close_button_; 66
86 FrameBackgroundView* frame_background_; 67 void PaintHeader(gfx::Canvas* canvas);
68 void PaintTitleBar(gfx::Canvas* canvas);
69
70 // Returns the correct bitmap for the frame header based on activation state
71 // and incognito mode.
72 SkBitmap* GetThemeFrameBitmap() const;
73 SkBitmap* GetThemeFrameOverlayBitmap() const;
74
75 // Returns the theme image bitmap for |bitmap_id| if the user has a custom
76 // theme image, or the bitmap for |fallback_bitmap_id| if not.
77 SkBitmap* GetCustomBitmap(int bitmap_id, int fallback_bitmap_id) const;
78
79 // Window controls.
80 views::ImageButton* maximize_button_;
81 views::ImageButton* close_button_;
82
83 // For popups, the window icon.
84 TabIconView* window_icon_;
85
86 // Window frame header/caption parts.
87 SkBitmap* button_separator_;
88 SkBitmap* top_left_corner_;
89 SkBitmap* top_edge_;
90 SkBitmap* top_right_corner_;
91 SkBitmap* header_left_edge_;
92 SkBitmap* header_right_edge_;
87 93
88 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAura); 94 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAura);
89 }; 95 };
90 96
91 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_AURA_H_ 97 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698