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

Side by Side Diff: chrome/browser/views/frame/opaque_frame.cc

Issue 27317: Support DWM switching.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 11 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
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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/views/frame/opaque_frame.h"
6
7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/views/frame/browser_view.h"
9 #include "chrome/browser/views/frame/opaque_non_client_view.h"
10 #include "chrome/browser/views/tabs/tab_strip.h"
11 #include "chrome/views/window_delegate.h"
12
13 ///////////////////////////////////////////////////////////////////////////////
14 // OpaqueFrame, public:
15
16 OpaqueFrame::OpaqueFrame(BrowserView* browser_view)
17 : CustomFrameWindow(browser_view, new OpaqueNonClientView(this,
18 browser_view)),
19 browser_view_(browser_view) {
20 browser_view_->set_frame(this);
21 }
22
23 OpaqueFrame::~OpaqueFrame() {
24 }
25
26 void OpaqueFrame::Init() {
27 CustomFrameWindow::Init(NULL, gfx::Rect());
28 }
29
30 ///////////////////////////////////////////////////////////////////////////////
31 // OpaqueFrame, BrowserFrame implementation:
32
33 gfx::Rect OpaqueFrame::GetWindowBoundsForClientBounds(
34 const gfx::Rect& client_bounds) {
35 return GetOpaqueNonClientView()->GetWindowBoundsForClientBounds(
36 client_bounds);
37 }
38
39 void OpaqueFrame::SizeToContents(const gfx::Rect& contents_bounds) {
40 gfx::Rect window_bounds = GetOpaqueNonClientView()->
41 GetWindowBoundsForClientBounds(contents_bounds);
42 SetBounds(window_bounds);
43 }
44
45 gfx::Rect OpaqueFrame::GetBoundsForTabStrip(TabStrip* tabstrip) const {
46 return GetOpaqueNonClientView()->GetBoundsForTabStrip(tabstrip);
47 }
48
49 void OpaqueFrame::UpdateThrobber(bool running) {
50 // TODO(beng): pass |running| through rather than letting
51 // OpaqueNonClientView's TabIconView try and figure it out.
52 // The throbber doesn't run in the Windows TaskBar, so we just update the
53 // non-client view. Updating the taskbar is muy expensivo.
54 GetOpaqueNonClientView()->UpdateWindowIcon();
55 }
56
57 views::Window* OpaqueFrame::GetWindow() {
58 return this;
59 }
60
61 const views::Window* OpaqueFrame::GetWindow() const {
62 return this;
63 }
64
65 ///////////////////////////////////////////////////////////////////////////////
66 // OpaqueFrame, views::CustomFrameWindow overrides:
67
68 void OpaqueFrame::UpdateWindowIcon() {
69 CustomFrameWindow::UpdateWindowIcon();
70 GetOpaqueNonClientView()->UpdateWindowIcon();
71 }
72
73 int OpaqueFrame::GetShowState() const {
74 return browser_view_->GetShowState();
75 }
76
77 ///////////////////////////////////////////////////////////////////////////////
78 // OpaqueFrame, views::WidgetWin overrides:
79
80 bool OpaqueFrame::AcceleratorPressed(views::Accelerator* accelerator) {
81 return browser_view_->AcceleratorPressed(*accelerator);
82 }
83
84 bool OpaqueFrame::GetAccelerator(int cmd_id, views::Accelerator* accelerator) {
85 return browser_view_->GetAccelerator(cmd_id, accelerator);
86 }
87
88 void OpaqueFrame::OnEndSession(BOOL ending, UINT logoff) {
89 BrowserList::WindowsSessionEnding();
90 }
91
92 void OpaqueFrame::OnEnterSizeMove() {
93 browser_view_->WindowMoveOrResizeStarted();
94 }
95
96 void OpaqueFrame::OnInitMenuPopup(HMENU menu, UINT position,
97 BOOL is_system_menu) {
98 browser_view_->PrepareToRunSystemMenu(menu);
99 }
100
101 LRESULT OpaqueFrame::OnMouseActivate(HWND window, UINT hittest_code,
102 UINT message) {
103 return browser_view_->ActivateAppModalDialog() ? MA_NOACTIVATEANDEAT
104 : MA_ACTIVATE;
105 }
106
107 void OpaqueFrame::OnMove(const CPoint& point) {
108 browser_view_->WindowMoved();
109 }
110
111 void OpaqueFrame::OnMoving(UINT param, const RECT* new_bounds) {
112 browser_view_->WindowMoved();
113 }
114
115 LRESULT OpaqueFrame::OnNCActivate(BOOL active) {
116 if (browser_view_->ActivateAppModalDialog())
117 return TRUE;
118
119 CustomFrameWindow::OnNCActivate(active);
120 browser_view_->ActivationChanged(!!active);
121 return TRUE;
122 }
123
124 void OpaqueFrame::OnSysCommand(UINT notification_code, CPoint click) {
125 if (!browser_view_->SystemCommandReceived(notification_code,
126 gfx::Point(click))) {
127 // Use the default implementation for any other command.
128 CustomFrameWindow::OnSysCommand(notification_code, click);
129 }
130 }
131
132 ///////////////////////////////////////////////////////////////////////////////
133 // OpaqueFrame, private:
134
135 OpaqueNonClientView* OpaqueFrame::GetOpaqueNonClientView() const {
136 // We can safely assume that this conversion is true.
137 return static_cast<OpaqueNonClientView*>(non_client_view_);
138 }
139
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/opaque_frame.h ('k') | chrome/browser/views/frame/opaque_non_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698