OLD | NEW |
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 #include "chrome/browser/ui/views/frame/browser_frame_win.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_win.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 17 matching lines...) Expand all Loading... |
28 static const int kClientEdgeThickness = 3; | 28 static const int kClientEdgeThickness = 3; |
29 static const int kTabDragWindowAlpha = 200; | 29 static const int kTabDragWindowAlpha = 200; |
30 // We need to offset the DWMFrame into the toolbar so that the blackness | 30 // We need to offset the DWMFrame into the toolbar so that the blackness |
31 // doesn't show up on our rounded corners. | 31 // doesn't show up on our rounded corners. |
32 static const int kDWMFrameTopOffset = 3; | 32 static const int kDWMFrameTopOffset = 3; |
33 | 33 |
34 // static (Factory method.) | 34 // static (Factory method.) |
35 BrowserFrame* BrowserFrame::Create(BrowserView* browser_view, | 35 BrowserFrame* BrowserFrame::Create(BrowserView* browser_view, |
36 Profile* profile) { | 36 Profile* profile) { |
37 BrowserFrameWin* frame = new BrowserFrameWin(browser_view, profile); | 37 BrowserFrameWin* frame = new BrowserFrameWin(browser_view, profile); |
38 frame->Init(); | 38 frame->InitBrowserFrame(); |
39 return frame; | 39 return frame; |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 const gfx::Font& BrowserFrame::GetTitleFont() { | 43 const gfx::Font& BrowserFrame::GetTitleFont() { |
44 static gfx::Font* title_font = | 44 static gfx::Font* title_font = |
45 new gfx::Font(views::WindowWin::GetWindowTitleFont()); | 45 new gfx::Font(views::WindowWin::GetWindowTitleFont()); |
46 return *title_font; | 46 return *title_font; |
47 } | 47 } |
48 | 48 |
49 /////////////////////////////////////////////////////////////////////////////// | 49 /////////////////////////////////////////////////////////////////////////////// |
50 // BrowserFrame, public: | 50 // BrowserFrame, public: |
51 | 51 |
52 BrowserFrameWin::BrowserFrameWin(BrowserView* browser_view, Profile* profile) | 52 BrowserFrameWin::BrowserFrameWin(BrowserView* browser_view, Profile* profile) |
53 : WindowWin(browser_view), | 53 : WindowWin(browser_view), |
54 browser_view_(browser_view), | 54 browser_view_(browser_view), |
55 root_view_(NULL), | 55 root_view_(NULL), |
56 frame_initialized_(false), | 56 frame_initialized_(false), |
57 profile_(profile) { | 57 profile_(profile) { |
58 browser_view_->set_frame(this); | 58 browser_view_->set_frame(this); |
59 GetNonClientView()->SetFrameView(CreateFrameViewForWindow()); | 59 GetNonClientView()->SetFrameView(CreateFrameViewForWindow()); |
60 // Don't focus anything on creation, selecting a tab will set the focus. | 60 // Don't focus anything on creation, selecting a tab will set the focus. |
61 set_focus_on_creation(false); | 61 set_focus_on_creation(false); |
62 } | 62 } |
63 | 63 |
64 void BrowserFrameWin::Init() { | 64 void BrowserFrameWin::InitBrowserFrame() { |
65 WindowWin::Init(NULL, gfx::Rect()); | 65 WindowWin::Init(NULL, gfx::Rect()); |
66 } | 66 } |
67 | 67 |
68 BrowserFrameWin::~BrowserFrameWin() { | 68 BrowserFrameWin::~BrowserFrameWin() { |
69 } | 69 } |
70 | 70 |
71 views::Window* BrowserFrameWin::GetWindow() { | 71 views::Window* BrowserFrameWin::GetWindow() { |
72 return this; | 72 return this; |
73 } | 73 } |
74 | 74 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 gfx::Rect tabstrip_bounds( | 303 gfx::Rect tabstrip_bounds( |
304 GetBoundsForTabStrip(browser_view_->tabstrip())); | 304 GetBoundsForTabStrip(browser_view_->tabstrip())); |
305 margins.cyTopHeight = (browser_view_->UseVerticalTabs() ? | 305 margins.cyTopHeight = (browser_view_->UseVerticalTabs() ? |
306 tabstrip_bounds.y() : tabstrip_bounds.bottom()) + kDWMFrameTopOffset; | 306 tabstrip_bounds.y() : tabstrip_bounds.bottom()) + kDWMFrameTopOffset; |
307 } | 307 } |
308 } else { | 308 } else { |
309 // For popup and app windows we want to use the default margins. | 309 // For popup and app windows we want to use the default margins. |
310 } | 310 } |
311 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); | 311 DwmExtendFrameIntoClientArea(GetNativeView(), &margins); |
312 } | 312 } |
OLD | NEW |